js/src/tests/test262/ch09/9.4/S9.4_A3_T2.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 // Copyright 2009 the Sputnik authors. All rights reserved.
michael@0 2 // This code is governed by the BSD license found in the LICENSE file.
michael@0 3
michael@0 4 /**
michael@0 5 * Result of ToInteger(value) conversion is the result of computing
michael@0 6 * sign(ToNumber(value)) * floor(abs(ToNumber(value)))
michael@0 7 *
michael@0 8 * @path ch09/9.4/S9.4_A3_T2.js
michael@0 9 * @description For testing constructor Date(NaN, Infinity, Infinity, +0 and -0) is used
michael@0 10 */
michael@0 11
michael@0 12 // CHECK#1
michael@0 13 var d1 = new Date(Number.NaN);
michael@0 14 if (!isNaN(d1.valueOf())) {
michael@0 15 $ERROR('#1: var d1 = new Date(Number.NaN); d1.valueOf() === Number.NaN;');
michael@0 16 }
michael@0 17
michael@0 18 // CHECK#2
michael@0 19 var d2 = new Date(Infinity);
michael@0 20 if (!isNaN(d2.valueOf())) {
michael@0 21 $ERROR('#2: var d2 = new Date(Infinity); d2.valueOf() === Number.NaN;');
michael@0 22 }
michael@0 23
michael@0 24 // CHECK#3
michael@0 25 var d3 = new Date(-Infinity);
michael@0 26 if (!isNaN(d3.valueOf())) {
michael@0 27 $ERROR('#3: var d3 = new Date(-Infinity); d3.valueOf() === Number.NaN;');
michael@0 28 }
michael@0 29
michael@0 30 // CHECK#4
michael@0 31 var d4 = new Date(0);
michael@0 32 if (d4.valueOf() !== 0) {
michael@0 33 $ERROR('#4: var d4 = new Date(0); d4.valueOf() === 0;');
michael@0 34 }
michael@0 35
michael@0 36 // CHECK#5
michael@0 37 var d5 = new Date(-0);
michael@0 38 if (d5.valueOf() !== -0) {
michael@0 39 $ERROR('#5: var d5 = new Date(-0); d5.valueOf() === -0;');
michael@0 40 }
michael@0 41

mercurial