1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/Expressions/11.4.7-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + * File Name: 11.4.7-02.js 1.12 + * Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=432881 1.13 + * Description: ecma 11.4.7 1.14 + */ 1.15 + 1.16 +var SECTION = "11.4.7"; 1.17 +var VERSION = "ECMA"; 1.18 +var TITLE = "Unary - Operator"; 1.19 +var BUGNUMBER = "432881"; 1.20 + 1.21 +startTest(); 1.22 + 1.23 +test_negation(0, -0.0); 1.24 +test_negation(-0.0, 0); 1.25 +test_negation(1, -1); 1.26 +test_negation(1.0/0.0, -1.0/0.0); 1.27 +test_negation(-1.0/0.0, 1.0/0.0); 1.28 + 1.29 +//1073741824 == (1 << 30) 1.30 +test_negation(1073741824, -1073741824); 1.31 +test_negation(-1073741824, 1073741824); 1.32 + 1.33 +//1073741824 == (1 << 30) - 1 1.34 +test_negation(1073741823, -1073741823); 1.35 +test_negation(-1073741823, 1073741823); 1.36 + 1.37 +//1073741824 == (1 << 30) 1.38 +test_negation(1073741824, -1073741824); 1.39 +test_negation(-1073741824, 1073741824); 1.40 + 1.41 +//1073741824 == (1 << 30) - 1 1.42 +test_negation(1073741823, -1073741823); 1.43 +test_negation(-1073741823, 1073741823); 1.44 + 1.45 +//2147483648 == (1 << 31) 1.46 +test_negation(2147483648, -2147483648); 1.47 +test_negation(-2147483648, 2147483648); 1.48 + 1.49 +//2147483648 == (1 << 31) - 1 1.50 +test_negation(2147483647, -2147483647); 1.51 +test_negation(-2147483647, 2147483647); 1.52 + 1.53 +function test_negation(value, expected) 1.54 +{ 1.55 + var actual = -value; 1.56 + reportCompare(expected, actual, '-(' + value + ') == ' + expected); 1.57 +}