]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/GlobalObject/15.1.2.6.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 File Name: 15.1.2.6.js
24 ECMA Section: 15.1.2.6 isNaN( x )
26 Description: Applies ToNumber to its argument, then returns true if
27 the result isNaN and otherwise returns false.
29 Author: christine@netscape.com
33 var SECTION
= "15.1.2.6" ;
34 var VERSION
= "ECMA_1" ;
36 var TITLE
= "isNaN( x )" ;
38 var BUGNUMBER
= "77391" ;
40 writeHeaderToLog ( SECTION
+ " " + TITLE
);
42 var testcases
= getTestCases ();
47 function getTestCases () {
48 var array
= new Array ();
51 array
[ item
++] = new TestCase ( SECTION
, "isNaN.length" , 1 , isNaN
. length
);
52 array
[ item
++] = new TestCase ( SECTION
, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS" , "" , eval ( "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS" ) );
53 array
[ item
++] = new TestCase ( SECTION
, "isNaN.length = null; isNaN.length" , 1 , eval ( "isNaN.length=null; isNaN.length" ) );
54 array
[ item
++] = new TestCase ( SECTION
, "delete isNaN.length" , false , delete isNaN
. length
);
55 array
[ item
++] = new TestCase ( SECTION
, "delete isNaN.length; isNaN.length" , 1 , eval ( "delete isNaN.length; isNaN.length" ) );
57 // array[item++] = new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ );
59 array
[ item
++] = new TestCase ( SECTION
, "isNaN()" , true , isNaN () );
60 array
[ item
++] = new TestCase ( SECTION
, "isNaN( null )" , false , isNaN ( null ) );
61 array
[ item
++] = new TestCase ( SECTION
, "isNaN( void 0 )" , true , isNaN ( void 0 ) );
62 array
[ item
++] = new TestCase ( SECTION
, "isNaN( true )" , false , isNaN ( true ) );
63 array
[ item
++] = new TestCase ( SECTION
, "isNaN( false)" , false , isNaN ( false ) );
64 array
[ item
++] = new TestCase ( SECTION
, "isNaN( ' ' )" , false , isNaN ( " " ) );
66 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 0 )" , false , isNaN ( 0 ) );
67 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 1 )" , false , isNaN ( 1 ) );
68 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 2 )" , false , isNaN ( 2 ) );
69 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 3 )" , false , isNaN ( 3 ) );
70 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 4 )" , false , isNaN ( 4 ) );
71 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 5 )" , false , isNaN ( 5 ) );
72 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 6 )" , false , isNaN ( 6 ) );
73 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 7 )" , false , isNaN ( 7 ) );
74 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 8 )" , false , isNaN ( 8 ) );
75 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 9 )" , false , isNaN ( 9 ) );
77 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '0' )" , false , isNaN ( '0' ) );
78 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '1' )" , false , isNaN ( '1' ) );
79 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '2' )" , false , isNaN ( '2' ) );
80 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '3' )" , false , isNaN ( '3' ) );
81 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '4' )" , false , isNaN ( '4' ) );
82 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '5' )" , false , isNaN ( '5' ) );
83 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '6' )" , false , isNaN ( '6' ) );
84 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '7' )" , false , isNaN ( '7' ) );
85 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '8' )" , false , isNaN ( '8' ) );
86 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '9' )" , false , isNaN ( '9' ) );
89 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 0x0a )" , false , isNaN ( 0x0a ) );
90 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 0xaa )" , false , isNaN ( 0xaa ) );
91 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 0x0A )" , false , isNaN ( 0x0A ) );
92 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 0xAA )" , false , isNaN ( 0xAA ) );
94 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '0x0a' )" , false , isNaN ( "0x0a" ) );
95 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '0xaa' )" , false , isNaN ( "0xaa" ) );
96 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '0x0A' )" , false , isNaN ( "0x0A" ) );
97 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '0xAA' )" , false , isNaN ( "0xAA" ) );
99 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 077 )" , false , isNaN ( 077 ) );
100 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '077' )" , false , isNaN ( "077" ) );
103 array
[ item
++] = new TestCase ( SECTION
, "isNaN( Number.NaN )" , true , isNaN ( Number
. NaN
) );
104 array
[ item
++] = new TestCase ( SECTION
, "isNaN( Number.POSITIVE_INFINITY )" , false , isNaN ( Number
. POSITIVE_INFINITY
) );
105 array
[ item
++] = new TestCase ( SECTION
, "isNaN( Number.NEGATIVE_INFINITY )" , false , isNaN ( Number
. NEGATIVE_INFINITY
) );
106 array
[ item
++] = new TestCase ( SECTION
, "isNaN( Number.MAX_VALUE )" , false , isNaN ( Number
. MAX_VALUE
) );
107 array
[ item
++] = new TestCase ( SECTION
, "isNaN( Number.MIN_VALUE )" , false , isNaN ( Number
. MIN_VALUE
) );
109 array
[ item
++] = new TestCase ( SECTION
, "isNaN( NaN )" , true , isNaN ( NaN
) );
110 array
[ item
++] = new TestCase ( SECTION
, "isNaN( Infinity )" , false , isNaN ( Infinity
) );
112 array
[ item
++] = new TestCase ( SECTION
, "isNaN( 'Infinity' )" , false , isNaN ( "Infinity" ) );
113 array
[ item
++] = new TestCase ( SECTION
, "isNaN( '-Infinity' )" , false , isNaN ( "-Infinity" ) );
118 for ( tc
= 0 ; tc
< testcases
. length
; tc
++ ) {
119 testcases
[ tc
]. passed
= writeTestCaseResult (
120 testcases
[ tc
]. expect
,
121 testcases
[ tc
]. actual
,
122 testcases
[ tc
]. description
+ " = " + testcases
[ tc
]. actual
);
123 testcases
[ tc
]. reason
+= ( testcases
[ tc
]. passed
) ? "" : "wrong value " ;
126 return ( testcases
);