js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A2.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

     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  * The MV of StringNumericLiteral ::: StrWhiteSpace is 0
     6  *
     7  * @path ch09/9.3/9.3.1/S9.3.1_A2.js
     8  * @description Strings with various WhiteSpaces convert to Number by explicit transformation
     9  */
    11 // CHECK#1
    12 if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== 0) {
    13   $ERROR('#1.1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === 0. Actual: ' + (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")));
    14 } else {
    15   if (1/Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number.POSITIVE_INFINITY) {
    16     $ERROR('#1.2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === +0. Actual: -0');
    17   }	
    18 }
    20 // CHECK#2
    21 if (Number(" ") !== 0) {
    22   $ERROR('#2.1: Number(" ") === 0. Actual: ' + (Number(" ")));
    23 } else {
    24   if (1/Number(" ") !== Number.POSITIVE_INFINITY) {
    25     $ERROR('#2.2: Number(" ") === +0. Actual: -0');
    26   }	
    27 }
    29 // CHECK#3
    30 if (Number("\t") !== 0) {
    31   $ERROR('#3.1: Number("\\t") === 0. Actual: ' + (Number("\t")));
    32 } else {
    33   if (1/Number("\t") !== Number.POSITIVE_INFINITY) {
    34     $ERROR('#3.2: Number("\\t") === +0. Actual: -0');
    35   }	
    36 }
    38 // CHECK#4
    39 if (Number("\r") !== 0) {
    40   $ERROR('#4.1: Number("\\r") === 0. Actual: ' + (Number("\r")));
    41 } else {
    42   if (1/Number("\r") !== Number.POSITIVE_INFINITY) {
    43     $ERROR('#4.2: Number("\\r") === +0. Actual: -0');
    44   }	
    45 }
    47 // CHECK#5
    48 if (Number("\n") !== 0) {
    49   $ERROR('#5.1: Number("\\n") === 0. Actual: ' + (Number("\n")));
    50 } else {
    51   if (1/Number("\n") !== Number.POSITIVE_INFINITY) {
    52     $ERROR('#5.2: Number("\\n") === +0. Actual: -0');
    53   }	
    54 }
    56 // CHECK#6
    57 if (Number("\f") !== 0) {
    58   $ERROR('#6.1: Number("\\f") === 0. Actual: ' + (Number("\f")));
    59 } else {
    60   if (1/Number("\f") !== Number.POSITIVE_INFINITY) {
    61     $ERROR('#6.2: Number("\\f") === +0. Actual: -0');
    62   }	
    63 }
    65 // CHECK#7
    66 if (Number("\u0009") !== 0) {
    67   $ERROR('#7.1: Number("\\u0009") === 0. Actual: ' + (Number("\u0009")));
    68 } else {
    69   if (1/Number("\u0009") !== Number.POSITIVE_INFINITY) {
    70     $ERROR('#7.2: Number("\\u0009") === +0. Actual: -0');
    71   }	
    72 }
    74 // CHECK#8
    75 if (Number("\u000A") !== 0) {
    76   $ERROR('#8.1: Number("\\u000A") === 0. Actual: ' + (Number("\u000A")));
    77 } else {
    78   if (1/Number("\u000A") !== Number.POSITIVE_INFINITY) {
    79     $ERROR('#8.2: Number("\\u000A") === +0. Actual: -0');
    80   }	
    81 }
    83 // CHECK#9
    84 if (Number("\u000B") !== 0) {
    85   $ERROR('#9.1: Number("\\u000B") === 0. Actual: ' + (Number("\u000B")));
    86 } else {
    87   if (1/Number("\u000B") !== Number.POSITIVE_INFINITY) {
    88     $ERROR('#9.1.2: Number("\\u000B") === +0. Actual: -0');
    89   }	
    90 }
    92 // CHECK#10
    93 if (Number("\u000C") !== 0) {
    94   $ERROR('#10.1: Number("\\u000C") === 0. Actual: ' + (Number("\u000C")));
    95 } else {
    96   if (1/Number("\u000C") !== Number.POSITIVE_INFINITY) {
    97     $ERROR('#10.2: Number("\\u000C") === +0. Actual: -0');
    98   }	
    99 }
   101 // CHECK#11
   102 if (Number("\u000D") !== 0) {
   103   $ERROR('#11.1: Number("\\u000D") === 0. Actual: ' + (Number("\u000D")));
   104 } else {
   105   if (1/Number("\u000D") !== Number.POSITIVE_INFINITY) {
   106     $ERROR('#11.2: Number("\\u000D") === +0. Actual: -0');
   107   }	
   108 }
   110 // CHECK#12
   111 if (Number("\u00A0") !== 0) {
   112   $ERROR('#12.1: Number("\\u00A0") === 0. Actual: ' + (Number("\u00A0")));
   113 } else {
   114   if (1/Number("\u00A0") !== Number.POSITIVE_INFINITY) {
   115     $ERROR('#12.2: Number("\\u00A0") === +0. Actual: -0');
   116   }	
   117 }
   119 // CHECK#13
   120 if (Number("\u0020") !== 0) {
   121   $ERROR('#13.1: Number("\\u0020") === 0. Actual: ' + (Number("\u0020")));
   122 } else {
   123   if (1/Number("\u0020") !== Number.POSITIVE_INFINITY) {
   124     $ERROR('#13.2: Number("\\u0020") === +0. Actual: -0');
   125   }	
   126 }
   128 // CHECK#14
   129 if (Number("\u2028") !== 0) {
   130   $ERROR('#14.1: Number("\\u2028") === 0. Actual: ' + (Number("\u2028")));
   131 } else {
   132   if (1/Number("\u2028") !== Number.POSITIVE_INFINITY) {
   133     $ERROR('#14.2: Number("\\u2028") === +0. Actual: -0');
   134   }	
   135 }
   137 // CHECK#15
   138 if (Number("\u2029") !== 0) {
   139   $ERROR('#15.1: Number("\\u2029") === 0. Actual: ' + (Number("\u2029")));
   140 } else {
   141   if (1/Number("\u2029") !== Number.POSITIVE_INFINITY) {
   142     $ERROR('#15.2: Number("\\u2029") === +0. Actual: -0');
   143   }	
   144 }
   146 // CHECK#16
   147 if (Number("\u1680") !== 0) {
   148   $ERROR('#16.1: Number("\\u1680") === 0. Actual: ' + (Number("\u1680")));
   149 } else {
   150   if (1/Number("\u1680") !== Number.POSITIVE_INFINITY) {
   151     $ERROR('#16.2: Number("\\u1680") === +0. Actual: -0');
   152   }	
   153 }
   155 // CHECK#17
   156 if (Number("\u180E") !== 0) {
   157   $ERROR('#17.1: Number("\\u180E") === 0. Actual: ' + (Number("\u180E")));
   158 } else {
   159   if (1/Number("\u180E") !== Number.POSITIVE_INFINITY) {
   160     $ERROR('#17.2: Number("\\u180E") === +0. Actual: -0');
   161   }	
   162 }
   164 // CHECK#18
   165 if (Number("\u2000") !== 0) {
   166   $ERROR('#18.1: Number("\\u2000") === 0. Actual: ' + (Number("\u2000")));
   167 } else {
   168   if (1/Number("\u2000") !== Number.POSITIVE_INFINITY) {
   169     $ERROR('#18.2: Number("\\u2000") === +0. Actual: -0');
   170   }	
   171 }
   173 // CHECK#19
   174 if (Number("\u2001") !== 0) {
   175   $ERROR('#19.1: Number("\\u2001") === 0. Actual: ' + (Number("\u2001")));
   176 } else {
   177   if (1/Number("\u2001") !== Number.POSITIVE_INFINITY) {
   178     $ERROR('#19.2: Number("\\u2001") === +0. Actual: -0');
   179   }	
   180 }
   182 // CHECK#20
   183 if (Number("\u2002") !== 0) {
   184   $ERROR('#20.1: Number("\\u2002") === 0. Actual: ' + (Number("\u2002")));
   185 } else {
   186   if (1/Number("\u2002") !== Number.POSITIVE_INFINITY) {
   187     $ERROR('#20.2: Number("\\u2002") === +0. Actual: -0');
   188   }	
   189 }
   191 // CHECK#21
   192 if (Number("\u2003") !== 0) {
   193   $ERROR('#21.1: Number("\\u2003") === 0. Actual: ' + (Number("\u2003")));
   194 } else {
   195   if (1/Number("\u2003") !== Number.POSITIVE_INFINITY) {
   196     $ERROR('#21.2: Number("\\u2003") === +0. Actual: -0');
   197   }	
   198 }
   200 // CHECK#22
   201 if (Number("\u2004") !== 0) {
   202   $ERROR('#22.1: Number("\\u2004") === 0. Actual: ' + (Number("\u2004")));
   203 } else {
   204   if (1/Number("\u2004") !== Number.POSITIVE_INFINITY) {
   205     $ERROR('#22.2: Number("\\u2004") === +0. Actual: -0');
   206   }	
   207 }
   209 // CHECK#23
   210 if (Number("\u2005") !== 0) {
   211   $ERROR('#23.1: Number("\\u2005") === 0. Actual: ' + (Number("\u2005")));
   212 } else {
   213   if (1/Number("\u2005") !== Number.POSITIVE_INFINITY) {
   214     $ERROR('#23.2: Number("\\u2005") === +0. Actual: -0');
   215   }	
   216 }
   218 // CHECK#24
   219 if (Number("\u2006") !== 0) {
   220   $ERROR('#24.1: Number("\\u2006") === 0. Actual: ' + (Number("\u2006")));
   221 } else {
   222   if (1/Number("\u2006") !== Number.POSITIVE_INFINITY) {
   223     $ERROR('#24.2: Number("\\u2006") === +0. Actual: -0');
   224   }	
   225 }
   227 // CHECK#25
   228 if (Number("\u2007") !== 0) {
   229   $ERROR('#25.1: Number("\\u2007") === 0. Actual: ' + (Number("\u2007")));
   230 } else {
   231   if (1/Number("\u2007") !== Number.POSITIVE_INFINITY) {
   232     $ERROR('#25.2: Number("\\u2007") === +0. Actual: -0');
   233   }	
   234 }
   236 // CHECK#26
   237 if (Number("\u2008") !== 0) {
   238   $ERROR('#26.1: Number("\\u2008") === 0. Actual: ' + (Number("\u2008")));
   239 } else {
   240   if (1/Number("\u2008") !== Number.POSITIVE_INFINITY) {
   241     $ERROR('#26.2: Number("\\u2008") === +0. Actual: -0');
   242   }	
   243 }
   245 // CHECK#27
   246 if (Number("\u2009") !== 0) {
   247   $ERROR('#27.1: Number("\\u2009") === 0. Actual: ' + (Number("\u2009")));
   248 } else {
   249   if (1/Number("\u2009") !== Number.POSITIVE_INFINITY) {
   250     $ERROR('#27.2: Number("\\u2009") === +0. Actual: -0');
   251   }	
   252 }
   254 // CHECK#28
   255 if (Number("\u200A") !== 0) {
   256   $ERROR('#28.1: Number("\\u200A") === 0. Actual: ' + (Number("\u200A")));
   257 } else {
   258   if (1/Number("\u200A") !== Number.POSITIVE_INFINITY) {
   259     $ERROR('#28.2: Number("\\u200A") === +0. Actual: -0');
   260   }	
   261 }
   263 // CHECK#29
   264 if (Number("\u202F") !== 0) {
   265   $ERROR('#29.1: Number("\\u202F") === 0. Actual: ' + (Number("\u202F")));
   266 } else {
   267   if (1/Number("\u202F") !== Number.POSITIVE_INFINITY) {
   268     $ERROR('#29.2: Number("\\u202F") === +0. Actual: -0');
   269   }	
   270 }
   272 // CHECK#30
   273 if (Number("\u205F") !== 0) {
   274   $ERROR('#30.1: Number("\\u205F") === 0. Actual: ' + (Number("\u205F")));
   275 } else {
   276   if (1/Number("\u205F") !== Number.POSITIVE_INFINITY) {
   277     $ERROR('#30.2: Number("\\u205F") === +0. Actual: -0');
   278   }	
   279 }
   281 // CHECK#31
   282 if (Number("\u3000") !== 0) {
   283   $ERROR('#31.1: Number("\\u3000") === 0. Actual: ' + (Number("\u3000")));
   284 } else {
   285   if (1/Number("\u3000") !== Number.POSITIVE_INFINITY) {
   286     $ERROR('#31.2: Number("\\u3000") === +0. Actual: -0');
   287   }	
   288 }

mercurial