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.

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

mercurial