]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js
27d31be0ec078cbe904dd226ac6364b286fea1ca
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.2-1.js
24 ECMA Section: 15.1.2.2 Function properties of the global object
25 parseInt( string, radix )
27 Description: parseInt test cases written by waldemar, and documented in
28 http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874.
30 Author: christine@netscape.com
34 var SECTION
= "15.1.2.2-2" ;
35 var VERSION
= "ECMA_1" ;
37 var TITLE
= "parseInt(string, radix)" ;
38 var BUGNUMBER
= "123874" ;
40 writeHeaderToLog ( SECTION
+ " " + TITLE
);
42 var testcases
= new Array ();
44 testcases
[ tc
++] = new TestCase ( SECTION
,
45 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)' ,
47 parseInt ( "000000100000000100100011010001010110011110001001101010111100" , 2 ) );
49 testcases
[ tc
++] = new TestCase ( SECTION
,
50 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)' ,
52 parseInt ( "000000100000000100100011010001010110011110001001101010111101" , 2 ));
54 testcases
[ tc
++] = new TestCase ( SECTION
,
55 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)' ,
57 parseInt ( "000000100000000100100011010001010110011110001001101010111111" , 2 ) );
59 testcases
[ tc
++] = new TestCase ( SECTION
,
60 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)' ,
62 parseInt ( "0000001000000001001000110100010101100111100010011010101111010" , 2 ) );
64 testcases
[ tc
++] = new TestCase ( SECTION
,
65 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)' ,
67 parseInt ( "0000001000000001001000110100010101100111100010011010101111011" , 2 ));
69 testcases
[ tc
++] = new TestCase ( SECTION
,
70 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)' ,
72 parseInt ( "0000001000000001001000110100010101100111100010011010101111100" , 2 ) );
74 testcases
[ tc
++] = new TestCase ( SECTION
,
75 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)' ,
77 parseInt ( "0000001000000001001000110100010101100111100010011010101111110" , 2 ) );
79 testcases
[ tc
++] = new TestCase ( SECTION
,
84 testcases
[ tc
++] = new TestCase ( SECTION
,
89 testcases
[ tc
++] = new TestCase ( SECTION
,
94 testcases
[ tc
++] = new TestCase ( SECTION
,
99 testcases
[ tc
++] = new TestCase ( SECTION
,
104 testcases
[ tc
++] = new TestCase ( SECTION
,
105 'parseInt(" \u200012 34 \u2000 ")' ,
107 parseInt ( " \u200012 34 \u2000 " ) );
109 testcases
[ tc
++] = new TestCase ( SECTION
,
110 'parseInt("123456789012345678")' ,
112 parseInt ( "123456789012345678" ) );
114 testcases
[ tc
++] = new TestCase ( SECTION
,
119 testcases
[ tc
++] = new TestCase ( SECTION
,
124 testcases
[ tc
++] = new TestCase ( SECTION
,
125 'parseInt("1.9999999999999999999")' ,
127 parseInt ( "1.9999999999999999999" ) );
129 testcases
[ tc
++] = new TestCase ( SECTION
,
134 testcases
[ tc
++] = new TestCase ( SECTION
,
135 'parseInt("0x10",10)' ,
137 parseInt ( "0x10" , 10 ));
139 testcases
[ tc
++] = new TestCase ( SECTION
,
144 testcases
[ tc
++] = new TestCase ( SECTION
,
145 'parseInt("0022",10)' ,
147 parseInt ( "0022" , 10 ) );
149 testcases
[ tc
++] = new TestCase ( SECTION
,
150 'parseInt("0x1000000000000080")' ,
152 parseInt ( "0x1000000000000080" ) );
154 testcases
[ tc
++] = new TestCase ( SECTION
,
155 'parseInt("0x1000000000000081")' ,
157 parseInt ( "0x1000000000000081" ) );
160 "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
162 s
+= "0000000000000000000000000000000000000" ;
164 testcases
[ tc
++] = new TestCase ( SECTION
,
166 - 1.7976931348623157e+308 ,
170 "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ;
171 s
+= "0000000000000000000000000000000000001" ;
173 testcases
[ tc
++] = new TestCase ( SECTION
,
175 - 1.7976931348623157e+308 ,
179 s
= "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ;
181 s
+= "0000000000000000000000000000000000000"
184 testcases
[ tc
++] = new TestCase ( SECTION
,
189 s
= "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ;
190 s
+= "0000000000000000000000000000000000001" ;
192 testcases
[ tc
++] = new TestCase ( SECTION
,
194 - 1.7976931348623157e+308 ,
199 testcases
[ tc
++] = new TestCase ( SECTION
,
204 testcases
[ tc
++] = new TestCase ( SECTION
,
209 testcases
[ tc
++] = new TestCase ( SECTION
,
214 testcases
[ tc
++] = new TestCase ( SECTION
,
221 function test ( array
) {
222 for ( tc
= 0 ; tc
< testcases
. length
; tc
++ ) {
223 testcases
[ tc
]. passed
= writeTestCaseResult (
224 testcases
[ tc
]. expect
,
225 testcases
[ tc
]. actual
,
226 testcases
[ tc
]. description
+ " = " + testcases
[ tc
]. actual
);
228 testcases
[ tc
]. reason
+= ( testcases
[ tc
]. passed
) ? "" : "wrong value " ;
231 return ( testcases
);