js/src/tests/test262/ch09/9.7/S9.7_A1.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  * If value is NaN, +0, -0, +Infinity, or -Infinity, return +0
     6  *
     7  * @path ch09/9.7/S9.7_A1.js
     8  * @description For testing use String.fromCharCode(Number).charCodeAt(0) construction
     9  */
    11 // CHECK#1
    12 if (String.fromCharCode(Number.NaN).charCodeAt(0) !== +0) {
    13   $ERROR('#1.1: String.fromCharCode(Number.NaN).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number.NaN).charCodeAt(0)));
    14 } else if (1/String.fromCharCode(Number.NaN).charCodeAt(0) !== Number.POSITIVE_INFINITY) {
    15   $ERROR('#1.2: String.fromCharCode(Number.NaN).charCodeAt(0) === +0. Actual: -0');
    16 }
    18 // CHECK#2
    19 if (String.fromCharCode(Number("abc")).charCodeAt(0) !== +0) {
    20   $ERROR('#2.1: String.fromCharCode(Number("abc")).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number("abc")).charCodeAt(0)));
    21 } else if (1/String.fromCharCode(0).charCodeAt(0) !== Number.POSITIVE_INFINITY) {
    22   $ERROR('#2.2: String.fromCharCode(0).charCodeAt(0) === +0. Actual: -0');
    23 }
    25 // CHECK#3
    26 if (String.fromCharCode(0).charCodeAt(0) !== +0) {
    27   $ERROR('#3.1: String.fromCharCode(0).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(0).charCodeAt(0)));
    28 } else if (1/String.fromCharCode(0).charCodeAt(0) !== Number.POSITIVE_INFINITY) {
    29   $ERROR('#3.2: String.fromCharCode(0).charCodeAt(0) === +0. Actual: -0');
    30 }
    32 // CHECK#4
    33 if (String.fromCharCode(-0).charCodeAt(0) !== +0) {
    34   $ERROR("#4.1: String.fromCharCode(-0).charCodeAt(0) === +0");
    35 } else if (1/String.fromCharCode(-0).charCodeAt(0) !== Number.POSITIVE_INFINITY) {
    36   $ERROR("#4.2: String.fromCharCode(-0).charCodeAt(0) === +0. Actual: -0");
    37 }
    39 // CHECK#5
    40 if (String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) !== +0) {
    41   $ERROR('#5.1: String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)));
    42 } else if (1/String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) !== Number.POSITIVE_INFINITY) {
    43   $ERROR('#5.2: String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) === +0. Actual: -0');
    44 }
    46 // CHECK#6
    47 if (String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) !== +0) {
    48   $ERROR("#6.1: String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) === +0");
    49 } else if (1/String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) !== Number.POSITIVE_INFINITY) {
    50   $ERROR("#6.2: String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) === +0. Actual: -0");
    51 }

mercurial