js/src/tests/ecma/Expressions/11.4.7-02.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8  *  File Name:          11.4.7-02.js
     9  *  Reference:          https://bugzilla.mozilla.org/show_bug.cgi?id=432881
    10  *  Description:        ecma 11.4.7
    11  */
    13 var SECTION = "11.4.7";
    14 var VERSION = "ECMA";
    15 var TITLE   = "Unary - Operator";
    16 var BUGNUMBER = "432881";
    18 startTest();
    20 test_negation(0, -0.0);
    21 test_negation(-0.0, 0);
    22 test_negation(1, -1);
    23 test_negation(1.0/0.0, -1.0/0.0);
    24 test_negation(-1.0/0.0, 1.0/0.0);
    26 //1073741824 == (1 << 30)
    27 test_negation(1073741824, -1073741824);
    28 test_negation(-1073741824, 1073741824);
    30 //1073741824 == (1 << 30) - 1
    31 test_negation(1073741823, -1073741823);
    32 test_negation(-1073741823, 1073741823);
    34 //1073741824 == (1 << 30)
    35 test_negation(1073741824, -1073741824);
    36 test_negation(-1073741824, 1073741824);
    38 //1073741824 == (1 << 30) - 1
    39 test_negation(1073741823, -1073741823);
    40 test_negation(-1073741823, 1073741823);
    42 //2147483648 == (1 << 31)
    43 test_negation(2147483648, -2147483648);
    44 test_negation(-2147483648, 2147483648);
    46 //2147483648 == (1 << 31) - 1
    47 test_negation(2147483647, -2147483647);
    48 test_negation(-2147483647, 2147483647);
    50 function test_negation(value, expected)
    51 {
    52     var actual = -value;
    53     reportCompare(expected, actual, '-(' + value + ') == ' + expected);
    54 } 

mercurial