Debian Codegraph @

rhino/testsrc/tests/ecma/Expressions/11.4.7-02.js

raw symbols SCIP
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/. */
5
6 gTestfile = '11.4.7-02.js';
7
8 /**
9 * File Name: 11.4.7-02.js
10 * Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=432881
11 * Description: ecma 11.4.7
12 */
13
14 var SECTION = "11.4.7";
15 var VERSION = "ECMA";
16 var TITLE = "Unary - Operator";
17 var BUGNUMBER = "432881";
18
19 startTest();
20
21 test_negation(0, -0.0);
22 test_negation(-0.0, 0);
23 test_negation(1, -1);
24 test_negation(1.0/0.0, -1.0/0.0);
25 test_negation(-1.0/0.0, 1.0/0.0);
26
27 //1073741824 == (1 << 30)
28 test_negation(1073741824, -1073741824);
29 test_negation(-1073741824, 1073741824);
30
31 //1073741824 == (1 << 30) - 1
32 test_negation(1073741823, -1073741823);
33 test_negation(-1073741823, 1073741823);
34
35 //1073741824 == (1 << 30)
36 test_negation(1073741824, -1073741824);
37 test_negation(-1073741824, 1073741824);
38
39 //1073741824 == (1 << 30) - 1
40 test_negation(1073741823, -1073741823);
41 test_negation(-1073741823, 1073741823);
42
43 //2147483648 == (1 << 31)
44 test_negation(2147483648, -2147483648);
45 test_negation(-2147483648, 2147483648);
46
47 //2147483648 == (1 << 31) - 1
48 test_negation(2147483647, -2147483647);
49 test_negation(-2147483647, 2147483647);
50
51 function test_negation(value, expected)
52 {
53 var actual = -value;
54 reportCompare(expected, actual, '-(' + value + ') == ' + expected);
55 }