michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: * File Name: 11.4.7-02.js michael@0: * Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=432881 michael@0: * Description: ecma 11.4.7 michael@0: */ michael@0: michael@0: var SECTION = "11.4.7"; michael@0: var VERSION = "ECMA"; michael@0: var TITLE = "Unary - Operator"; michael@0: var BUGNUMBER = "432881"; michael@0: michael@0: startTest(); michael@0: michael@0: test_negation(0, -0.0); michael@0: test_negation(-0.0, 0); michael@0: test_negation(1, -1); michael@0: test_negation(1.0/0.0, -1.0/0.0); michael@0: test_negation(-1.0/0.0, 1.0/0.0); michael@0: michael@0: //1073741824 == (1 << 30) michael@0: test_negation(1073741824, -1073741824); michael@0: test_negation(-1073741824, 1073741824); michael@0: michael@0: //1073741824 == (1 << 30) - 1 michael@0: test_negation(1073741823, -1073741823); michael@0: test_negation(-1073741823, 1073741823); michael@0: michael@0: //1073741824 == (1 << 30) michael@0: test_negation(1073741824, -1073741824); michael@0: test_negation(-1073741824, 1073741824); michael@0: michael@0: //1073741824 == (1 << 30) - 1 michael@0: test_negation(1073741823, -1073741823); michael@0: test_negation(-1073741823, 1073741823); michael@0: michael@0: //2147483648 == (1 << 31) michael@0: test_negation(2147483648, -2147483648); michael@0: test_negation(-2147483648, 2147483648); michael@0: michael@0: //2147483648 == (1 << 31) - 1 michael@0: test_negation(2147483647, -2147483647); michael@0: test_negation(-2147483647, 2147483647); michael@0: michael@0: function test_negation(value, expected) michael@0: { michael@0: var actual = -value; michael@0: reportCompare(expected, actual, '-(' + value + ') == ' + expected); michael@0: }