2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 ok(i === 0, "parseInt('0') = " + i);
24 ok(i === 123, "parseInt('123') = " + i);
26 ok(i === -123, "parseInt('-123') = " + i);
28 ok(i === 0xff, "parseInt('0xff') = " + i);
29 i = parseInt("11", 8);
30 ok(i === 9, "parseInt('11', 8) = " + i);
31 i = parseInt("1j", 22);
32 ok(i === 41, "parseInt('1j', 32) = " + i);
33 i = parseInt("123", 0);
34 ok(i === 123, "parseInt('123', 0) = " + i);
35 i = parseInt("123", 10, "test");
36 ok(i === 123, "parseInt('123', 10, 'test') = " + i);
37 i = parseInt("11", "8");
38 ok(i === 9, "parseInt('11', '8') = " + i);
40 tmp = encodeURI("abc");
41 ok(tmp === "abc", "encodeURI('abc') = " + tmp);
42 tmp = encodeURI("{abc}");
43 ok(tmp === "%7Babc%7D", "encodeURI('{abc}') = " + tmp);
45 ok(tmp === "", "encodeURI('') = " + tmp);
46 tmp = encodeURI("\01\02\03\04");
47 ok(tmp === "%01%02%03%04", "encodeURI('\\01\\02\\03\\04') = " + tmp);
48 tmp = encodeURI("{#@}");
49 ok(tmp === "%7B#@%7D", "encodeURI('{#@}') = " + tmp);
50 tmp = encodeURI("\xa1 ");
51 ok(tmp === "%C2%A1%20", "encodeURI(\\xa1 ) = " + tmp);
52 tmp = encodeURI("\xffff");
53 ok(tmp.length === 8, "encodeURI('\\xffff').length = " + tmp.length);
54 tmp = encodeURI("abcABC123;/?:@&=+$,-_.!~*'()");
55 ok(tmp === "abcABC123;/?:@&=+$,-_.!~*'()", "encodeURI('abcABC123;/?:@&=+$,-_.!~*'()') = " + tmp);
57 ok(tmp === "undefined", "encodeURI() = " + tmp);
58 tmp = encodeURI("abc", "test");
59 ok(tmp === "abc", "encodeURI('abc') = " + tmp);
61 tmp = encodeURIComponent("abc");
62 ok(tmp === "abc", "encodeURIComponent('abc') = " + tmp);
63 tmp = encodeURIComponent("{abc}");
64 ok(tmp === "%7Babc%7D", "encodeURIComponent('{abc}') = " + tmp);
65 tmp = encodeURIComponent("");
66 ok(tmp === "", "encodeURIComponent('') = " + tmp);
67 tmp = encodeURIComponent("\01\02\03\04");
68 ok(tmp === "%01%02%03%04", "encodeURIComponent('\\01\\02\\03\\04') = " + tmp);
69 tmp = encodeURIComponent("{#@}");
70 ok(tmp === "%7B%23%40%7D", "encodeURIComponent('{#@}') = " + tmp);
71 tmp = encodeURIComponent("\xa1 ");
72 ok(tmp === "%C2%A1%20", "encodeURIComponent(\\xa1 ) = " + tmp);
73 tmp = encodeURIComponent("\xffff");
74 ok(tmp.length === 8, "encodeURIComponent('\\xffff').length = " + tmp.length);
75 tmp = encodeURIComponent("abcABC123;/?:@&=+$,-_.!~*'()");
76 ok(tmp === "abcABC123%3B%2F%3F%3A%40%26%3D%2B%24%2C-_.!~*'()", "encodeURIComponent('abcABC123;/?:@&=+$,-_.!~*'()') = " + tmp);
77 tmp = encodeURIComponent();
78 ok(tmp === "undefined", "encodeURIComponent() = " + tmp);
79 tmp = encodeURIComponent("abc", "test");
80 ok(tmp === "abc", "encodeURIComponent('abc') = " + tmp);
83 ok(tmp === "abc", "escape('abc') = " + tmp);
85 ok(tmp === "", "escape('') = " + tmp);
86 tmp = escape("a1b c!d+e@*-_+./,");
87 ok(tmp === "a1b%20c%21d+e@*-_+./%2C", "escape('a1b c!d+e@*-_+./,') = " + tmp);
89 ok(tmp === "undefined", "escape() = " + tmp);
90 tmp = escape('\u1234\123\xf3');
91 ok(tmp == "%u1234S%F3", "escape('\u1234\123\xf3') = " + tmp);
93 tmp = unescape("abc");
94 ok(tmp === "abc", "unescape('abc') = " + tmp);
96 ok(tmp === "", "unescape('') = " + tmp);
97 tmp = unescape("%%%");
98 ok(tmp === "%%%", "unescape('%%%') = " + tmp);
100 ok(tmp === "undefined", "unescape() = " + tmp);
101 tmp = unescape("%54%65s%u0074");
102 ok(tmp === "Test", "unescape('%54%65s%u0074') = " + tmp);
104 tmp = "aA1~`!@#$%^&*()_+=-][{}';:/.,<>?\|";
105 ok(escape(tmp) === "aA1%7E%60%21@%23%24%25%5E%26*%28%29_+%3D-%5D%5B%7B%7D%27%3B%3A/.%2C%3C%3E%3F%7C", "escape('" + tmp + "') = " + escape(tmp));
106 ok(unescape(escape(tmp)) === tmp, "unescape(escape('" + tmp + "')) = " + unescape(escape(tmp)));
108 tmp = "" + new Object();
109 ok(tmp === "[object Object]", "'' + new Object() = " + tmp);
110 (tmp = new Array).f = Object.prototype.toString;
111 ok(tmp.f() === "[object Array]", "tmp.f() = " + tmp.f());
112 (tmp = new Boolean).f = Object.prototype.toString;
113 ok(tmp.f() === "[object Boolean]", "tmp.f() = " + tmp.f());
114 (tmp = new Date).f = Object.prototype.toString;
115 ok(tmp.f() === "[object Date]", "tmp.f() = " + tmp.f());
116 (tmp = function() {}).f = Object.prototype.toString;
117 ok(tmp.f() === "[object Function]", "tmp.f() = " + tmp.f());
118 Math.f = Object.prototype.toString;
119 ok(Math.f() === "[object Math]", "tmp.f() = " + tmp.f());
120 (tmp = new Number).f = Object.prototype.toString;
121 ok(tmp.f() === "[object Number]", "tmp.f() = " + tmp.f());
122 (tmp = new RegExp("")).f = Object.prototype.toString;
123 ok(tmp.f() === "[object RegExp]", "tmp.f() = " + tmp.f());
124 (tmp = new String).f = Object.prototype.toString;
125 ok(tmp.f() === "[object String]", "tmp.f() = " + tmp.f());
126 tmp = Object.prototype.toString.call(testObj);
127 ok(tmp === "[object Object]", "toString.call(testObj) = " + tmp);
128 tmp = Object.prototype.toString.call(this);
129 ok(tmp === "[object Object]", "toString.call(this) = " + tmp);
130 (function () { tmp = Object.prototype.toString.call(arguments); })();
131 ok(tmp === "[object Object]", "toString.call(arguments) = " + tmp);
133 ok(Object(1) instanceof Number, "Object(1) is not instance of Number");
134 ok(Object("") instanceof String, "Object('') is not instance of String");
135 ok(Object(false) instanceof Boolean, "Object(false) is not instance of Boolean");
138 ok(Object(obj) === obj, "Object(obj) !== obj");
140 ok(typeof(Object()) === "object", "typeof(Object()) !== 'object'");
141 ok(typeof(Object(undefined)) === "object", "typeof(Object(undefined)) !== 'object'");
142 ok(typeof(Object(null)) === "object", "typeof(Object(null)) !== 'object'");
144 var obj = new Object();
145 obj.toString = function (x) {
146 ok(arguments.length === 0, "arguments.length = " + arguments.length);
149 ok((tmp = obj.toLocaleString()) === "test", "obj.toLocaleString() = " + tmp);
150 ok((tmp = obj.toLocaleString(1)) === "test", "obj.toLocaleString(1) = " + tmp);
151 ok(obj === obj.valueOf(), "obj !== obj.valueOf");
153 ok("".length === 0, "\"\".length = " + "".length);
154 ok(getVT("".length) == "VT_I4", "\"\".length = " + "".length);
155 ok("abc".length === 3, "\"abc\".length = " + "abc".length);
156 ok(String.prototype.length === 0, "String.prototype.length = " + String.prototype.length);
159 ok(tmp === "", "''.toString() = " + tmp);
160 tmp = "test".toString();
161 ok(tmp === "test", "''.toString() = " + tmp);
162 tmp = "test".toString(3);
163 ok(tmp === "test", "''.toString(3) = " + tmp);
166 ok(tmp === "", "''.valueOf() = " + tmp);
167 tmp = "test".valueOf();
168 ok(tmp === "test", "''.valueOf() = " + tmp);
169 tmp = "test".valueOf(3);
170 ok(tmp === "test", "''.valueOf(3) = " + tmp);
172 var str = new String("test");
173 ok(str.toString() === "test", "str.toString() = " + str.toString());
174 var str = new String();
175 ok(str.toString() === "", "str.toString() = " + str.toString());
176 var str = new String("test", "abc");
177 ok(str.toString() === "test", "str.toString() = " + str.toString());
179 var strObj = new Object();
180 strObj.toString = function() { return "abcd" };
181 strObj.substr = String.prototype.substr;
182 strObj.lastIndexOf = String.prototype.lastIndexOf;
184 tmp = "value " + str;
185 ok(tmp === "value test", "'value ' + str = " + tmp);
188 ok(tmp === "", "String() = " + tmp);
190 ok(tmp === "false", "String(false) = " + tmp);
192 ok(tmp === "null", "String(null) = " + tmp);
193 tmp = String("test");
194 ok(tmp === "test", "String('test') = " + tmp);
195 tmp = String("test", "abc");
196 ok(tmp === "test", "String('test','abc') = " + tmp);
198 tmp = "abc".charAt(0);
199 ok(tmp === "a", "'abc',charAt(0) = " + tmp);
200 tmp = "abc".charAt(1);
201 ok(tmp === "b", "'abc',charAt(1) = " + tmp);
202 tmp = "abc".charAt(2);
203 ok(tmp === "c", "'abc',charAt(2) = " + tmp);
204 tmp = "abc".charAt(3);
205 ok(tmp === "", "'abc',charAt(3) = " + tmp);
206 tmp = "abc".charAt(4);
207 ok(tmp === "", "'abc',charAt(4) = " + tmp);
208 tmp = "abc".charAt();
209 ok(tmp === "a", "'abc',charAt() = " + tmp);
210 tmp = "abc".charAt(-1);
211 ok(tmp === "", "'abc',charAt(-1) = " + tmp);
212 tmp = "abc".charAt(0,2);
213 ok(tmp === "a", "'abc',charAt(0.2) = " + tmp);
215 tmp = "abc".charCodeAt(0);
216 ok(tmp === 0x61, "'abc'.charCodeAt(0) = " + tmp);
217 tmp = "abc".charCodeAt(1);
218 ok(tmp === 0x62, "'abc'.charCodeAt(1) = " + tmp);
219 tmp = "abc".charCodeAt(2);
220 ok(tmp === 0x63, "'abc'.charCodeAt(2) = " + tmp);
221 tmp = "abc".charCodeAt();
222 ok(tmp === 0x61, "'abc'.charCodeAt() = " + tmp);
223 tmp = "abc".charCodeAt(true);
224 ok(tmp === 0x62, "'abc'.charCodeAt(true) = " + tmp);
225 tmp = "abc".charCodeAt(0,2);
226 ok(tmp === 0x61, "'abc'.charCodeAt(0,2) = " + tmp);
227 tmp = "\u49F4".charCodeAt(0);
228 ok(tmp === 0x49F4, "'\u49F4'.charCodeAt(0) = " + tmp);
229 tmp = "\052".charCodeAt(0);
230 ok(tmp === 0x2A, "'\052'.charCodeAt(0) = " + tmp);
231 tmp = "\xa2".charCodeAt(0);
232 ok(tmp === 0xA2, "'\xa2'.charCodeAt(0) = " + tmp);
234 tmp = "abcd".substring(1,3);
235 ok(tmp === "bc", "'abcd'.substring(1,3) = " + tmp);
236 tmp = "abcd".substring(-1,3);
237 ok(tmp === "abc", "'abcd'.substring(-1,3) = " + tmp);
238 tmp = "abcd".substring(1,6);
239 ok(tmp === "bcd", "'abcd'.substring(1,6) = " + tmp);
240 tmp = "abcd".substring(3,1);
241 ok(tmp === "bc", "'abcd'.substring(3,1) = " + tmp);
242 tmp = "abcd".substring(2,2);
243 ok(tmp === "", "'abcd'.substring(2,2) = " + tmp);
244 tmp = "abcd".substring(true,"3");
245 ok(tmp === "bc", "'abcd'.substring(true,'3') = " + tmp);
246 tmp = "abcd".substring(1,3,2);
247 ok(tmp === "bc", "'abcd'.substring(1,3,2) = " + tmp);
248 tmp = "abcd".substring();
249 ok(tmp === "abcd", "'abcd'.substring() = " + tmp);
251 tmp = "abcd".substr(1,3);
252 ok(tmp === "bcd", "'abcd'.substr(1,3) = " + tmp);
253 tmp = "abcd".substr(-1,3);
254 ok(tmp === "abc", "'abcd'.substr(-1,3) = " + tmp);
255 tmp = "abcd".substr(1,6);
256 ok(tmp === "bcd", "'abcd'.substr(1,6) = " + tmp);
257 tmp = "abcd".substr(2,-1);
258 ok(tmp === "", "'abcd'.substr(3,1) = " + tmp);
259 tmp = "abcd".substr(2,0);
260 ok(tmp === "", "'abcd'.substr(2,2) = " + tmp);
261 tmp = "abcd".substr(true,"3");
262 ok(tmp === "bcd", "'abcd'.substr(true,'3') = " + tmp);
263 tmp = "abcd".substr(1,3,2);
264 ok(tmp === "bcd", "'abcd'.substr(1,3,2) = " + tmp);
265 tmp = "abcd".substr();
266 ok(tmp === "abcd", "'abcd'.substr() = " + tmp);
267 tmp = strObj.substr(1,1);
268 ok(tmp === "b", "'abcd'.substr(1,3) = " + tmp);
270 tmp = "abcd".slice(1,3);
271 ok(tmp === "bc", "'abcd'.slice(1,3) = " + tmp);
272 tmp = "abcd".slice(1,-1);
273 ok(tmp === "bc", "'abcd'.slice(1,-1) = " + tmp);
274 tmp = "abcd".slice(-3,3);
275 ok(tmp === "bc", "'abcd'.slice(-3,3) = " + tmp);
276 tmp = "abcd".slice(-6,3);
277 ok(tmp === "abc", "'abcd'.slice(-6,3) = " + tmp);
278 tmp = "abcd".slice(3,1);
279 ok(tmp === "", "'abcd'.slice(3,1) = " + tmp);
280 tmp = "abcd".slice(true,3);
281 ok(tmp === "bc", "'abcd'.slice(true,3) = " + tmp);
282 tmp = "abcd".slice();
283 ok(tmp === "abcd", "'abcd'.slice() = " + tmp);
284 tmp = "abcd".slice(1);
285 ok(tmp === "bcd", "'abcd'.slice(1) = " + tmp);
287 tmp = "abc".concat(["d",1],2,false);
288 ok(tmp === "abcd,12false", "concat returned " + tmp);
289 var arr = new Array(2,"a");
290 arr.concat = String.prototype.concat;
291 tmp = arr.concat("d");
292 ok(tmp === "2,ad", "arr.concat = " + tmp);
294 m = "a+bcabc".match("a+");
295 ok(typeof(m) === "object", "typeof m is not object");
296 ok(m.length === 1, "m.length is not 1");
297 ok(m["0"] === "a", "m[0] is not \"ab\"");
299 r = "- [test] -".replace("[test]", "success");
300 ok(r === "- success -", "r = " + r + " expected '- success -'");
302 r = "- [test] -".replace("[test]", "success", "test");
303 ok(r === "- success -", "r = " + r + " expected '- success -'");
305 r = "test".replace();
306 ok(r === "test", "r = " + r + " expected 'test'");
308 function replaceFunc3(m, off, str) {
309 ok(arguments.length === 3, "arguments.length = " + arguments.length);
310 ok(m === "[test]", "m = " + m + " expected [test1]");
311 ok(off === 1, "off = " + off + " expected 0");
312 ok(str === "-[test]-", "str = " + arguments[3]);
316 r = "-[test]-".replace("[test]", replaceFunc3);
317 ok(r === "-ret-", "r = " + r + " expected '-ret-'");
319 r = "-[test]-".replace("[test]", replaceFunc3, "test");
320 ok(r === "-ret-", "r = " + r + " expected '-ret-'");
322 r = "1,2,3".split(",");
323 ok(typeof(r) === "object", "typeof(r) = " + typeof(r));
324 ok(r.length === 3, "r.length = " + r.length);
325 ok(r[0] === "1", "r[0] = " + r[0]);
326 ok(r[1] === "2", "r[1] = " + r[1]);
327 ok(r[2] === "3", "r[2] = " + r[2]);
330 r = "1,2,3".split(",*");
331 ok(r.length === 1, "r.length = " + r.length);
332 ok(r[0] === "1,2,3", "r[0] = " + r[0]);
335 ok(r.length === 3, "r.length = " + r.length);
336 ok(r[0] === "1", "r[0] = " + r[0]);
337 ok(r[1] === "2", "r[1] = " + r[1]);
338 ok(r[2] === "3", "r[2] = " + r[2]);
341 ok(r.length === 2, "r.length = " + r.length);
342 ok(r[0] === "1", "r[0] = " + r[0]);
343 ok(r[1] === "3", "r[1] = " + r[1]);
345 r = "1,2,".split(",");
346 ok(typeof(r) === "object", "typeof(r) = " + typeof(r));
347 ok(r.length === 3, "r.length = " + r.length);
348 ok(r[0] === "1", "r[0] = " + r[0]);
349 ok(r[1] === "2", "r[1] = " + r[1]);
350 ok(r[2] === "", "r[2] = " + r[2]);
352 tmp = "abcd".indexOf("bc",0);
353 ok(tmp === 1, "indexOf = " + tmp);
354 tmp = "abcd".indexOf("bc",1);
355 ok(tmp === 1, "indexOf = " + tmp);
356 tmp = "abcd".indexOf("bc");
357 ok(tmp === 1, "indexOf = " + tmp);
358 tmp = "abcd".indexOf("ac");
359 ok(tmp === -1, "indexOf = " + tmp);
360 tmp = "abcd".indexOf("bc",2);
361 ok(tmp === -1, "indexOf = " + tmp);
362 tmp = "abcd".indexOf("a",0);
363 ok(tmp === 0, "indexOf = " + tmp);
364 tmp = "abcd".indexOf("bc",0,"test");
365 ok(tmp === 1, "indexOf = " + tmp);
366 tmp = "abcd".indexOf();
367 ok(tmp == -1, "indexOf = " + tmp);
369 tmp = "abcd".lastIndexOf("bc",1);
370 ok(tmp === 1, "lastIndexOf = " + tmp);
371 tmp = "abcd".lastIndexOf("bc",2);
372 ok(tmp === 1, "lastIndexOf = " + tmp);
373 tmp = "abcd".lastIndexOf("bc");
374 ok(tmp === 1, "lastIndexOf = " + tmp);
375 tmp = "abcd".lastIndexOf("ac");
376 ok(tmp === -1, "lastIndexOf = " + tmp);
377 tmp = "abcd".lastIndexOf("d",10);
378 ok(tmp === 3, "lastIndexOf = " + tmp);
379 tmp = "abcd".lastIndexOf("bc",0,"test");
380 ok(tmp === -1, "lastIndexOf = " + tmp);
381 tmp = "abcd".lastIndexOf();
382 ok(tmp === -1, "lastIndexOf = " + tmp);
383 tmp = "aaaa".lastIndexOf("a",2);
384 ok(tmp == 2, "lastIndexOf = " + tmp);
385 tmp = strObj.lastIndexOf("b");
386 ok(tmp === 1, "lastIndexOf = " + tmp);
388 tmp = "".toLowerCase();
389 ok(tmp === "", "''.toLowerCase() = " + tmp);
390 tmp = "test".toLowerCase();
391 ok(tmp === "test", "''.toLowerCase() = " + tmp);
392 tmp = "test".toLowerCase(3);
393 ok(tmp === "test", "''.toLowerCase(3) = " + tmp);
394 tmp = "tEsT".toLowerCase();
395 ok(tmp === "test", "''.toLowerCase() = " + tmp);
396 tmp = "tEsT".toLowerCase(3);
397 ok(tmp === "test", "''.toLowerCase(3) = " + tmp);
399 tmp = "".toUpperCase();
400 ok(tmp === "", "''.toUpperCase() = " + tmp);
401 tmp = "TEST".toUpperCase();
402 ok(tmp === "TEST", "''.toUpperCase() = " + tmp);
403 tmp = "TEST".toUpperCase(3);
404 ok(tmp === "TEST", "''.toUpperCase(3) = " + tmp);
405 tmp = "tEsT".toUpperCase();
406 ok(tmp === "TEST", "''.toUpperCase() = " + tmp);
407 tmp = "tEsT".toUpperCase(3);
408 ok(tmp === "TEST", "''.toUpperCase(3) = " + tmp);
411 ok(tmp === "<A NAME=\"undefined\"></A>", "''.anchor() = " + tmp);
413 ok(tmp === "<A NAME=\"3\"></A>", "''.anchor(3) = " + tmp);
414 tmp = "".anchor("red");
415 ok(tmp === "<A NAME=\"red\"></A>", "''.anchor('red') = " + tmp);
416 tmp = "test".anchor();
417 ok(tmp === "<A NAME=\"undefined\">test</A>", "'test'.anchor() = " + tmp);
418 tmp = "test".anchor(3);
419 ok(tmp === "<A NAME=\"3\">test</A>", "'test'.anchor(3) = " + tmp);
420 tmp = "test".anchor("green");
421 ok(tmp === "<A NAME=\"green\">test</A>", "'test'.anchor('green') = " + tmp);
424 ok(tmp === "<BIG></BIG>", "''.big() = " + tmp);
426 ok(tmp === "<BIG></BIG>", "''.big(3) = " + tmp);
428 ok(tmp === "<BIG>test</BIG>", "'test'.big() = " + tmp);
430 ok(tmp === "<BIG>test</BIG>", "'test'.big(3) = " + tmp);
433 ok(tmp === "<BLINK></BLINK>", "''.blink() = " + tmp);
435 ok(tmp === "<BLINK></BLINK>", "''.blink(3) = " + tmp);
436 tmp = "test".blink();
437 ok(tmp === "<BLINK>test</BLINK>", "'test'.blink() = " + tmp);
438 tmp = "test".blink(3);
439 ok(tmp === "<BLINK>test</BLINK>", "'test'.blink(3) = " + tmp);
442 ok(tmp === "<B></B>", "''.bold() = " + tmp);
444 ok(tmp === "<B></B>", "''.bold(3) = " + tmp);
446 ok(tmp === "<B>test</B>", "'test'.bold() = " + tmp);
447 tmp = "test".bold(3);
448 ok(tmp === "<B>test</B>", "'test'.bold(3) = " + tmp);
451 ok(tmp === "<TT></TT>", "''.fixed() = " + tmp);
453 ok(tmp === "<TT></TT>", "''.fixed(3) = " + tmp);
454 tmp = "test".fixed();
455 ok(tmp === "<TT>test</TT>", "'test'.fixed() = " + tmp);
456 tmp = "test".fixed(3);
457 ok(tmp === "<TT>test</TT>", "'test'.fixed(3) = " + tmp);
459 tmp = "".fontcolor();
460 ok(tmp === "<FONT COLOR=\"undefined\"></FONT>", "''.fontcolor() = " + tmp);
461 tmp = "".fontcolor(3);
462 ok(tmp === "<FONT COLOR=\"3\"></FONT>", "''.fontcolor(3) = " + tmp);
463 tmp = "".fontcolor("red");
464 ok(tmp === "<FONT COLOR=\"red\"></FONT>", "''.fontcolor('red') = " + tmp);
465 tmp = "test".fontcolor();
466 ok(tmp === "<FONT COLOR=\"undefined\">test</FONT>", "'test'.fontcolor() = " + tmp);
467 tmp = "test".fontcolor(3);
468 ok(tmp === "<FONT COLOR=\"3\">test</FONT>", "'test'.fontcolor(3) = " + tmp);
469 tmp = "test".fontcolor("green");
470 ok(tmp === "<FONT COLOR=\"green\">test</FONT>", "'test'.fontcolor('green') = " + tmp);
473 ok(tmp === "<FONT SIZE=\"undefined\"></FONT>", "''.fontsize() = " + tmp);
474 tmp = "".fontsize(3);
475 ok(tmp === "<FONT SIZE=\"3\"></FONT>", "''.fontsize(3) = " + tmp);
476 tmp = "".fontsize("red");
477 ok(tmp === "<FONT SIZE=\"red\"></FONT>", "''.fontsize('red') = " + tmp);
478 tmp = "test".fontsize();
479 ok(tmp === "<FONT SIZE=\"undefined\">test</FONT>", "'test'.fontsize() = " + tmp);
480 tmp = "test".fontsize(3);
481 ok(tmp === "<FONT SIZE=\"3\">test</FONT>", "'test'.fontsize(3) = " + tmp);
482 tmp = "test".fontsize("green");
483 ok(tmp === "<FONT SIZE=\"green\">test</FONT>", "'test'.fontsize('green') = " + tmp);
485 tmp = ("".fontcolor()).fontsize();
486 ok(tmp === "<FONT SIZE=\"undefined\"><FONT COLOR=\"undefined\"></FONT></FONT>", "(''.fontcolor()).fontsize() = " + tmp);
489 ok(tmp === "<I></I>", "''.italics() = " + tmp);
491 ok(tmp === "<I></I>", "''.italics(3) = " + tmp);
492 tmp = "test".italics();
493 ok(tmp === "<I>test</I>", "'test'.italics() = " + tmp);
494 tmp = "test".italics(3);
495 ok(tmp === "<I>test</I>", "'test'.italics(3) = " + tmp);
498 ok(tmp === "<A HREF=\"undefined\"></A>", "''.link() = " + tmp);
500 ok(tmp === "<A HREF=\"3\"></A>", "''.link(3) = " + tmp);
501 tmp = "".link("red");
502 ok(tmp === "<A HREF=\"red\"></A>", "''.link('red') = " + tmp);
504 ok(tmp === "<A HREF=\"undefined\">test</A>", "'test'.link() = " + tmp);
505 tmp = "test".link(3);
506 ok(tmp === "<A HREF=\"3\">test</A>", "'test'.link(3) = " + tmp);
507 tmp = "test".link("green");
508 ok(tmp === "<A HREF=\"green\">test</A>", "'test'.link('green') = " + tmp);
511 ok(tmp === "<SMALL></SMALL>", "''.small() = " + tmp);
513 ok(tmp === "<SMALL></SMALL>", "''.small(3) = " + tmp);
514 tmp = "test".small();
515 ok(tmp === "<SMALL>test</SMALL>", "'test'.small() = " + tmp);
516 tmp = "test".small(3);
517 ok(tmp === "<SMALL>test</SMALL>", "'test'.small(3) = " + tmp);
520 ok(tmp === "<STRIKE></STRIKE>", "''.strike() = " + tmp);
522 ok(tmp === "<STRIKE></STRIKE>", "''.strike(3) = " + tmp);
523 tmp = "test".strike();
524 ok(tmp === "<STRIKE>test</STRIKE>", "'test'.strike() = " + tmp);
525 tmp = "test".strike(3);
526 ok(tmp === "<STRIKE>test</STRIKE>", "'test'.strike(3) = " + tmp);
529 ok(tmp === "<SUB></SUB>", "''.sub() = " + tmp);
531 ok(tmp === "<SUB></SUB>", "''.sub(3) = " + tmp);
533 ok(tmp === "<SUB>test</SUB>", "'test'.sub() = " + tmp);
535 ok(tmp === "<SUB>test</SUB>", "'test'.sub(3) = " + tmp);
538 ok(tmp === "<SUP></SUP>", "''.sup() = " + tmp);
540 ok(tmp === "<SUP></SUP>", "''.sup(3) = " + tmp);
542 ok(tmp === "<SUP>test</SUP>", "'test'.sup() = " + tmp);
544 ok(tmp === "<SUP>test</SUP>", "'test'.sup(3) = " + tmp);
546 ok(String.fromCharCode() === "", "String.fromCharCode() = " + String.fromCharCode());
547 ok(String.fromCharCode(65,"66",67) === "ABC", "String.fromCharCode(65,'66',67) = " + String.fromCharCode(65,"66",67));
548 ok(String.fromCharCode(1024*64+65, -1024*64+65) === "AA",
549 "String.fromCharCode(1024*64+65, -1024*64+65) = " + String.fromCharCode(1024*64+65, -1024*64+65));
550 ok(String.fromCharCode(65, NaN, undefined).length === 3,
551 "String.fromCharCode(65, NaN, undefined).length = " + String.fromCharCode(65, NaN, undefined).length);
553 var arr = new Array();
554 ok(typeof(arr) === "object", "arr () is not object");
555 ok((arr.length === 0), "arr.length is not 0");
556 ok(arr["0"] === undefined, "arr[0] is not undefined");
558 var arr = new Array(1, 2, "test");
559 ok(typeof(arr) === "object", "arr (1,2,test) is not object");
560 ok((arr.length === 3), "arr.length is not 3");
561 ok(arr["0"] === 1, "arr[0] is not 1");
562 ok(arr["1"] === 2, "arr[1] is not 2");
563 ok(arr["2"] === "test", "arr[2] is not \"test\"");
566 ok((arr.length === 8), "arr.length is not 8");
569 ok(tmp === "", "'' + [] = " + tmp);
571 ok(tmp === "1,true", "'' + [1,true] = " + tmp);
573 var arr = new Array(6);
574 ok(typeof(arr) === "object", "arr (6) is not object");
575 ok((arr.length === 6), "arr.length is not 6");
576 ok(arr["0"] === undefined, "arr[0] is not undefined");
578 ok(arr.push() === 6, "arr.push() !== 6");
579 ok(arr.push(1) === 7, "arr.push(1) !== 7");
580 ok(arr[6] === 1, "arr[6] != 1");
581 ok(arr.length === 7, "arr.length != 10");
582 ok(arr.push(true, 'b', false) === 10, "arr.push(true, 'b', false) !== 10");
583 ok(arr[8] === "b", "arr[8] != 'b'");
584 ok(arr.length === 10, "arr.length != 10");
586 var arr = new Object();
587 arr.push = Array.prototype.push;
591 ok(arr.push() === 6, "arr.push() !== 6");
592 ok(arr.push(1) === 7, "arr.push(1) !== 7");
593 ok(arr[6] === 1, "arr[6] != 1");
594 ok(arr.length === 7, "arr.length != 10");
595 ok(arr.push(true, 'b', false) === 10, "arr.push(true, 'b', false) !== 10");
596 ok(arr[8] === "b", "arr[8] != 'b'");
597 ok(arr.length === 10, "arr.length != 10");
601 ok(arr.length === 2, "arr.length = " + arr.length);
602 ok(tmp === 5, "pop() = " + tmp);
604 ok(arr.length === 1, "arr.length = " + arr.length);
605 ok(tmp === 4, "pop() = " + tmp);
607 ok(arr.length === 0, "arr.length = " + arr.length);
608 ok(tmp === 3, "pop() = " + tmp);
610 ok(false, "not deleted " + tmp);
612 ok(arr.length === 0, "arr.length = " + arr.length);
613 ok(tmp === undefined, "tmp = " + tmp);
616 ok(arr.length === 5, "arr.length = " + arr.length);
617 ok(tmp === undefined, "tmp = " + tmp);
619 arr = [1,2,null,false,undefined,,"a"];
622 ok(tmp === "1,2,,false,,,a", "arr.join() = " + tmp);
624 ok(tmp === "1;2;;false;;;a", "arr.join(';') = " + tmp);
625 tmp = arr.join(";","test");
626 ok(tmp === "1;2;;false;;;a", "arr.join(';') = " + tmp);
628 ok(tmp === "12falsea", "arr.join('') = " + tmp);
630 tmp = arr.toString();
631 ok(tmp === "1,2,,false,,,a", "arr.toString() = " + tmp);
632 tmp = arr.toString("test");
633 ok(tmp === "1,2,,false,,,a", "arr.toString() = " + tmp);
635 arr = [5,true,2,-1,3,false,"2.5"];
636 tmp = arr.sort(function(x,y) { return y-x; });
637 ok(tmp === arr, "tmp !== arr");
638 tmp = [5,3,"2.5",2,true,false,-1];
639 for(var i=0; i < arr.length; i++)
640 ok(arr[i] === tmp[i], "arr[" + i + "] = " + arr[i] + " expected " + tmp[i]);
642 arr = [5,false,2,0,"abc",3,"a",-1];
644 ok(tmp === arr, "tmp !== arr");
645 tmp = [-1,0,2,3,5,"a","abc",false];
646 for(var i=0; i < arr.length; i++)
647 ok(arr[i] === tmp[i], "arr[" + i + "] = " + arr[i] + " expected " + tmp[i]);
649 arr = ["a", "b", "ab"];
650 tmp = ["a", "ab", "b"];
651 ok(arr.sort() === arr, "arr.sort() !== arr");
652 for(var i=0; i < arr.length; i++)
653 ok(arr[i] === tmp[i], "arr[" + i + "] = " + arr[i] + " expected " + tmp[i]);
655 arr = ["1", "2", "3"];
657 ok(arr.length === 1, "arr.length = " + arr.length);
659 ok(arr.length === 3, "arr.length = " + arr.length);
660 ok(arr.toString() === "1,,", "arr.toString() = " + arr.toString());
662 arr = Array("a","b","c");
663 ok(arr.toString() === "a,b,c", "arr.toString() = " + arr.toString());
665 ok(arr.valueOf === Object.prototype.valueOf, "arr.valueOf !== Object.prototype.valueOf");
666 ok(arr === arr.valueOf(), "arr !== arr.valueOf");
669 tmp = arr.unshift(0);
670 ok(tmp === (invokeVersion < 2 ? undefined : 4), "[1,2,3].unshift(0) returned " +tmp);
671 ok(arr.length === 4, "arr.length = " + arr.length);
672 ok(arr.toString() === "0,1,2,3", "arr.toString() = " + arr.toString());
677 tmp = arr.unshift(-1,0);
678 ok(tmp === (invokeVersion < 2 ? undefined : 5), "unshift returned " +tmp);
679 ok(arr.length === 5, "arr.length = " + arr.length);
680 ok(arr.toString() === "-1,0,1,,3", "arr.toString() = " + arr.toString());
684 ok(tmp === (invokeVersion < 2 ? undefined : 3), "unshift returned " +tmp);
685 ok(arr.length === 3, "arr.length = " + arr.length);
686 ok(arr.toString() === "1,2,3", "arr.toString() = " + arr.toString());
692 tmp = Array.prototype.unshift.call(arr, 0);
693 ok(tmp === (invokeVersion < 2 ? undefined : 3), "unshift returned " +tmp);
694 ok(arr.length === 3, "arr.length = " + arr.length);
695 ok(arr[0] === 0 && arr[1] === 1 && arr[2] === 2, "unexpected array");
699 ok(tmp === 1, "[1,2,,4].shift() = " + tmp);
700 ok(arr.toString() === "2,,4", "arr = " + arr.toString());
704 ok(tmp === undefined, "[].shift() = " + tmp);
705 ok(arr.toString() === "", "arr = " + arr.toString());
709 ok(tmp === 1, "[1,2,,4].shift(2) = " + tmp);
710 ok(arr.toString() === "2,,4", "arr = " + arr.toString());
714 ok(tmp === 1, "[1,].shift() = " + tmp);
715 ok(arr.toString() === "", "arr = " + arr.toString());
721 tmp = Array.prototype.shift.call(obj);
722 ok(tmp === "test", "obj.shift() = " + tmp);
723 ok(obj.length == 2, "obj.length = " + obj.length);
724 ok(obj[1] === 3, "obj[1] = " + obj[1]);
726 var num = new Number(6);
728 tmp = arr.concat(3, [4,5], num);
729 ok(tmp !== arr, "tmp === arr");
730 for(var i=0; i<6; i++)
731 ok(tmp[i] === i, "tmp[" + i + "] = " + tmp[i]);
732 ok(tmp[6] === num, "tmp[6] !== num");
733 ok(tmp.length === 7, "tmp.length = " + tmp.length);
736 ok(arr.length === 0, "arr.length = " + arr.length);
739 tmp = arr.concat([2]);
740 ok(tmp.length === 3, "tmp.length = " + tmp.length);
741 ok(tmp[1] === undefined, "tmp[1] = " + tmp[1]);
743 arr = [1,false,'a',null,undefined,'a'];
744 ok(arr.slice(0,6).toString() === "1,false,a,,,a", "arr.slice(0,6).toString() = " + arr.slice(0,6));
745 ok(arr.slice(0,6).length === 6, "arr.slice(0,6).length = " + arr.slice(0,6).length);
746 ok(arr.slice().toString() === "1,false,a,,,a", "arr.slice().toString() = " + arr.slice());
747 ok(arr.slice("abc").toString() === "1,false,a,,,a", "arr.slice(\"abc\").toString() = " + arr.slice("abc"));
748 ok(arr.slice(3,8).toString() === ",,a", "arr.slice(3,8).toString() = " + arr.slice(3,8));
749 ok(arr.slice(3,8).length === 3, "arr.slice(3,8).length = " + arr.slice(3,8).length);
750 ok(arr.slice(1).toString() === "false,a,,,a", "arr.slice(1).toString() = " + arr.slice(1));
751 ok(arr.slice(-2).toString() === ",a", "arr.slice(-2).toString() = " + arr.slice(-2));
752 ok(arr.slice(3,1).toString() === "", "arr.slice(3,1).toString() = " + arr.slice(3,1));
753 tmp = arr.slice(0,6);
754 for(var i=0; i < arr.length; i++)
755 ok(arr[i] === tmp[i], "arr[" + i + "] = " + arr[i] + " expected " + tmp[i]);
757 ok(arr.slice(5).toString() === "a,,,,,,,2", "arr.slice(5).toString() = " + arr.slice(5).toString());
758 ok(arr.slice(5).length === 8, "arr.slice(5).length = " + arr.slice(5).length);
761 tmp = arr.splice(2,2);
762 ok(tmp.toString() == "3,4", "arr.splice(2,2) returned " + tmp.toString());
763 ok(arr.toString() == "1,2,5", "arr.splice(2,2) is " + arr.toString());
766 tmp = arr.splice(2,2,"a");
767 ok(tmp.toString() == "3,4", "arr.splice(2,2,'a') returned " + tmp.toString());
768 ok(arr.toString() == "1,2,a,5", "arr.splice(2,2,'a') is " + arr.toString());
771 tmp = arr.splice(2,2,'a','b','c');
772 ok(tmp.toString() == "3,4", "arr.splice(2,2,'a','b','c') returned " + tmp.toString());
773 ok(arr.toString() == "1,2,a,b,c,5", "arr.splice(2,2,'a','b','c') is " + arr.toString());
776 tmp = arr.splice(2,2,'a','b','c');
777 ok(tmp.toString() == "3,4", "arr.splice(2,2,'a','b','c') returned " + tmp.toString());
778 ok(arr.toString() == "1,2,a,b,c,", "arr.splice(2,2,'a','b','c') is " + arr.toString());
781 arr.splice(2,2,'a','b','c');
782 ok(arr.toString() == "1,2,a,b,c,", "arr.splice(2,2,'a','b','c') is " + arr.toString());
785 tmp = arr.splice(2,2,'a','b');
786 ok(tmp.toString() == "3,4", "arr.splice(2,2,'a','b') returned " + tmp.toString());
787 ok(arr.toString() == "1,2,a,b,5", "arr.splice(2,2,'a','b') is " + arr.toString());
790 tmp = arr.splice(-1,2);
791 ok(tmp.toString() == "5", "arr.splice(-1,2) returned " + tmp.toString());
792 ok(arr.toString() == "1,2,3,4", "arr.splice(-1,2) is " + arr.toString());
795 tmp = arr.splice(-10,3);
796 ok(tmp.toString() == "1,2,3", "arr.splice(-10,3) returned " + tmp.toString());
797 ok(arr.toString() == "4,5", "arr.splice(-10,3) is " + arr.toString());
800 tmp = arr.splice(-10,100);
801 ok(tmp.toString() == "1,2,3,4,5", "arr.splice(-10,100) returned " + tmp.toString());
802 ok(arr.toString() == "", "arr.splice(-10,100) is " + arr.toString());
805 tmp = arr.splice(2,-1);
806 ok(tmp.toString() == "", "arr.splice(2,-1) returned " + tmp.toString());
807 ok(arr.toString() == "1,2,3,4,5", "arr.splice(2,-1) is " + arr.toString());
811 ok(tmp.toString() == "", "arr.splice(2,-1) returned " + tmp.toString());
812 ok(arr.toString() == "1,2,3,4,5", "arr.splice(2,-1) is " + arr.toString());
816 ok(tmp.toString() == "", "arr.splice(2,-1) returned " + tmp.toString());
817 ok(arr.toString() == "1,2,3,4,5", "arr.splice(2,-1) is " + arr.toString());
824 tmp = Array.prototype.splice.call(obj, 1, 1, 'a', 'b');
825 ok(tmp.toString() === "2", "obj.splice returned " + tmp);
826 ok(obj.length === 4, "obj.length = " + obj.length);
827 ok(obj[0] === 1, "obj[0] = " + obj[0]);
828 ok(obj[1] === 'a', "obj[1] = " + obj[1]);
829 ok(obj[2] === 'b', "obj[2] = " + obj[2]);
830 ok(obj[3] === 3, "obj[3] = " + obj[3]);
837 tmp = Array.prototype.slice.call(obj, 1, 2);
838 ok(tmp.length === 1, "tmp.length = " + tmp.length);
839 ok(tmp[0] === 2, "tmp[0] = " + tmp[0]);
841 var num = new Number(2);
842 ok(num.toString() === "2", "num(2).toString !== 2");
843 var num = new Number();
844 ok(num.toString() === "0", "num().toString !== 0");
846 ok(Number() === 0, "Number() = " + Number());
847 ok(Number(false) === 0, "Number(false) = " + Number(false));
848 ok(Number("43") === 43, "Number('43') = " + Number("43"));
850 tmp = (new Number(1)).valueOf();
851 ok(tmp === 1, "(new Number(1)).valueOf = " + tmp);
852 tmp = (new Number(1,2)).valueOf();
853 ok(tmp === 1, "(new Number(1,2)).valueOf = " + tmp);
854 tmp = (new Number()).valueOf();
855 ok(tmp === 0, "(new Number()).valueOf = " + tmp);
856 tmp = Number.prototype.valueOf();
857 ok(tmp === 0, "Number.prototype.valueOf = " + tmp);
859 function equals(val, base) {
862 var str = val.toString(base);
864 for(i=0; i<str.length; i++) {
865 if(str.substring(i, i+1) == '(') break;
866 if(str.substring(i, i+1) == '.') break;
867 num = num*base + parseInt(str.substring(i, i+1));
870 if(str.substring(i, i+1) == '.') {
872 for(i++; i<str.length; i++) {
873 if(str.substring(i, i+1) == '(') break;
874 num += parseInt(str.substring(i, i+1))/mult;
879 if(str.substring(i, i+1) == '(') {
880 exp = parseInt(str.substring(i+2));
881 num *= Math.pow(base, exp);
884 ok(num>val-val/1000 && num<val+val/1000, "equals: num = " + num);
887 ok((10).toString(11) === "a", "(10).toString(11) = " + (10).toString(11));
888 ok((213213433).toString(17) === "8e2ddcb", "(213213433).toString(17) = " + (213213433).toString(17));
889 ok((-3254343).toString(33) === "-2oicf", "(-3254343).toString(33) = " + (-3254343).toString(33));
890 ok((NaN).toString(12) === "NaN", "(NaN).toString(11) = " + (NaN).toString(11));
891 ok((Infinity).toString(13) === "Infinity", "(Infinity).toString(11) = " + (Infinity).toString(11));
892 for(i=2; i<10; i++) {
894 equals(2305843009200000000, i);
897 equals(1024*1024*1024*1024*1024*1024*1.9999, i);
900 equals(4.65661287308e-10, i);
901 ok((0).toString(i) === "0", "(0).toString("+i+") = " + (0).toString(i));
904 ok(parseFloat('123') === 123, "parseFloat('123') = " + parseFloat('123'));
905 ok(parseFloat('-13.7') === -13.7, "parseFloat('-13.7') = " + parseFloat('-13.7'));
906 ok(parseFloat('-0.01e-2') === -0.01e-2, "parseFloat('-0.01e-2') = " + parseFloat('-0.01e-2'));
907 ok(parseFloat('-12e+5') === -12e+5, "parseFloat('-12e+5') = " + parseFloat('-12e+5'));
908 ok(parseFloat('1E5 not parsed') === 1E5, "parseFloat('1E5 not parsed') = " + parseFloat('1E5 not parsed'));
909 ok(isNaN(parseFloat('not a number')), "parseFloat('not a number') is not NaN");
910 ok(parseFloat('+13.2e-3') === 13.2e-3, "parseFloat('+13.2e-3') = " + parseFloat('+13.2e-3'));
911 ok(parseFloat('.12') === 0.12, "parseFloat('.12') = " + parseFloat('.12'));
912 ok(parseFloat('1e') === 1, "parseFloat('1e') = " + parseFloat('1e'));
915 ok(tmp === 1, "Math.min(1) = " + tmp);
917 tmp = Math.min(1, false);
918 ok(tmp === 0, "Math.min(1, false) = " + tmp);
921 ok(tmp === Infinity, "Math.min() = " + tmp);
923 tmp = Math.min(1, NaN, -Infinity, false);
924 ok(isNaN(tmp), "Math.min(1, NaN, -Infinity, false) is not NaN");
926 tmp = Math.min(1, false, true, null, -3);
927 ok(tmp === -3, "Math.min(1, false, true, null, -3) = " + tmp);
930 ok(tmp === 1, "Math.max(1) = " + tmp);
932 tmp = Math.max(true, 0);
933 ok(tmp === 1, "Math.max(true, 0) = " + tmp);
935 tmp = Math.max(-2, false, true, null, 1);
936 ok(tmp === 1, "Math.max(-2, false, true, null, 1) = " + tmp);
939 ok(tmp === -Infinity, "Math.max() = " + tmp);
941 tmp = Math.max(true, NaN, 0);
942 ok(isNaN(tmp), "Math.max(true, NaN, 0) is not NaN");
944 tmp = Math.round(0.5);
945 ok(tmp === 1, "Math.round(0.5) = " + tmp);
947 tmp = Math.round(-0.5);
948 ok(tmp === 0, "Math.round(-0.5) = " + tmp);
950 tmp = Math.round(1.1);
951 ok(tmp === 1, "Math.round(1.1) = " + tmp);
953 tmp = Math.round(true);
954 ok(tmp === 1, "Math.round(true) = " + tmp);
956 tmp = Math.round(1.1, 3, 4);
957 ok(tmp === 1, "Math.round(1.1, 3, 4) = " + tmp);
960 ok(isNaN(tmp), "Math.round() is not NaN");
962 tmp = Math.ceil(0.5);
963 ok(tmp === 1, "Math.ceil(0.5) = " + tmp);
965 tmp = Math.ceil(-0.5);
966 ok(tmp === 0, "Math.ceil(-0.5) = " + tmp);
968 tmp = Math.ceil(1.1);
969 ok(tmp === 2, "Math.round(1.1) = " + tmp);
971 tmp = Math.ceil(true);
972 ok(tmp === 1, "Math.ceil(true) = " + tmp);
974 tmp = Math.ceil(1.1, 3, 4);
975 ok(tmp === 2, "Math.ceil(1.1, 3, 4) = " + tmp);
978 ok(isNaN(tmp), "ceil() is not NaN");
980 tmp = Math.floor(0.5);
981 ok(tmp === 0, "Math.floor(0.5) = " + tmp);
983 tmp = Math.floor(-0.5);
984 ok(tmp === -1, "Math.floor(-0.5) = " + tmp);
986 tmp = Math.floor(1.1);
987 ok(tmp === 1, "Math.floor(1.1) = " + tmp);
989 tmp = Math.floor(true);
990 ok(tmp === 1, "Math.floor(true) = " + tmp);
992 tmp = Math.floor(1.1, 3, 4);
993 ok(tmp === 1, "Math.floor(1.1, 3, 4) = " + tmp);
996 ok(isNaN(tmp), "floor is not NaN");
999 ok(tmp === 3, "Math.abs(3) = " + tmp);
1002 ok(tmp === 3, "Math.abs(-3) = " + tmp);
1004 tmp = Math.abs(true);
1005 ok(tmp === 1, "Math.abs(true) = " + tmp);
1008 ok(isNaN(tmp), "Math.abs() is not NaN");
1010 tmp = Math.abs(NaN);
1011 ok(isNaN(tmp), "Math.abs() is not NaN");
1013 tmp = Math.abs(-Infinity);
1014 ok(tmp === Infinity, "Math.abs(-Infinite) = " + tmp);
1016 tmp = Math.abs(-3, 2);
1017 ok(tmp === 3, "Math.abs(-3, 2) = " + tmp);
1020 ok(tmp === 1, "Math.cos(0) = " + tmp);
1022 tmp = Math.cos(Math.PI/2);
1023 ok(Math.floor(tmp*100) === 0, "Math.cos(Math.PI/2) = " + tmp);
1025 tmp = Math.cos(-Math.PI/2);
1026 ok(Math.floor(tmp*100) === 0, "Math.cos(-Math.PI/2) = " + tmp);
1028 tmp = Math.cos(Math.PI/3, 2);
1029 ok(Math.floor(tmp*100) === 50, "Math.cos(Math.PI/3, 2) = " + tmp);
1031 tmp = Math.cos(true);
1032 ok(Math.floor(tmp*100) === 54, "Math.cos(true) = " + tmp);
1034 tmp = Math.cos(false);
1035 ok(tmp === 1, "Math.cos(false) = " + tmp);
1038 ok(isNaN(tmp), "Math.cos() is not NaN");
1040 tmp = Math.cos(NaN);
1041 ok(isNaN(tmp), "Math.cos(NaN) is not NaN");
1043 tmp = Math.cos(Infinity);
1044 ok(isNaN(tmp), "Math.cos(Infinity) is not NaN");
1046 tmp = Math.cos(-Infinity);
1047 ok(isNaN(tmp), "Math.cos(-Infinity) is not NaN");
1049 tmp = Math.pow(2, 2);
1050 ok(tmp === 4, "Math.pow(2, 2) = " + tmp);
1052 tmp = Math.pow(4, 0.5);
1053 ok(tmp === 2, "Math.pow(2, 2) = " + tmp);
1055 tmp = Math.pow(2, 2, 3);
1056 ok(tmp === 4, "Math.pow(2, 2, 3) = " + tmp);
1059 ok(isNaN(tmp), "Math.pow(2) is not NaN");
1062 ok(isNaN(tmp), "Math.pow() is not NaN");
1064 tmp = Math.random();
1065 ok(typeof(tmp) == "number", "typeof(tmp) = " + typeof(tmp));
1066 ok(0 <= tmp && tmp <= 1, "Math.random() = " + tmp);
1068 tmp = Math.random(100);
1069 ok(typeof(tmp) == "number", "typeof(tmp) = " + typeof(tmp));
1070 ok(0 <= tmp && tmp <= 1, "Math.random(100) = " + tmp);
1073 ok(Math.floor(tmp*100) === 157, "Math.acos(0) = " + tmp);
1076 ok(Math.floor(tmp*100) === 0, "Math.acos(1) = " + tmp);
1078 tmp = Math.acos(-1);
1079 ok(Math.floor(tmp*100) === 314, "Math.acos(-1) = " + tmp);
1081 tmp = Math.acos(Math.PI/4, 2);
1082 ok(Math.floor(tmp*100) === 66, "Math.acos(Math.PI/4, 2) = " + tmp);
1084 tmp = Math.acos(true);
1085 ok(Math.floor(tmp*100) === 0, "Math.acos(true) = " + tmp);
1087 tmp = Math.acos(false);
1088 ok(Math.floor(tmp*100) === 157, "Math.acos(false) = " + tmp);
1090 tmp = Math.acos(1.1);
1091 ok(isNaN(tmp), "Math.acos(1.1) is not NaN");
1094 ok(isNaN(tmp), "Math.acos() is not NaN");
1096 tmp = Math.acos(NaN);
1097 ok(isNaN(tmp), "Math.acos(NaN) is not NaN");
1099 tmp = Math.acos(Infinity);
1100 ok(isNaN(tmp), "Math.acos(Infinity) is not NaN");
1102 tmp = Math.acos(-Infinity);
1103 ok(isNaN(tmp), "Math.acos(-Infinity) is not NaN");
1106 ok(Math.floor(tmp*100) === 0, "Math.asin(0) = " + tmp);
1109 ok(Math.floor(tmp*100) === 157, "Math.asin(1) = " + tmp);
1111 tmp = Math.asin(-1);
1112 ok(Math.floor(tmp*100) === -158, "Math.asin(-1) = " + tmp);
1114 tmp = Math.asin(Math.PI/4, 2);
1115 ok(Math.floor(tmp*100) === 90, "Math.asin(Math.PI/4, 2) = " + tmp);
1117 tmp = Math.asin(true);
1118 ok(Math.floor(tmp*100) === 157, "Math.asin(true) = " + tmp);
1120 tmp = Math.asin(false);
1121 ok(Math.floor(tmp*100) === 0, "Math.asin(false) = " + tmp);
1123 tmp = Math.asin(1.1);
1124 ok(isNaN(tmp), "Math.asin(1.1) is not NaN");
1127 ok(isNaN(tmp), "Math.asin() is not NaN");
1129 tmp = Math.asin(NaN);
1130 ok(isNaN(tmp), "Math.asin(NaN) is not NaN");
1132 tmp = Math.asin(Infinity);
1133 ok(isNaN(tmp), "Math.asin(Infinity) is not NaN");
1135 tmp = Math.asin(-Infinity);
1136 ok(isNaN(tmp), "Math.asin(-Infinity) is not NaN");
1139 ok(Math.floor(tmp*100) === 0, "Math.atan(0) = " + tmp);
1142 ok(Math.floor(tmp*100) === 78, "Math.atan(1) = " + tmp);
1144 tmp = Math.atan(-1);
1145 ok(Math.floor(tmp*100) === -79, "Math.atan(-1) = " + tmp);
1147 tmp = Math.atan(true);
1148 ok(Math.floor(tmp*100) === 78, "Math.atan(true) = " + tmp);
1150 tmp = Math.atan(false);
1151 ok(Math.floor(tmp*100) === 0, "Math.atan(false) = " + tmp);
1154 ok(isNaN(tmp), "Math.atan() is not NaN");
1156 tmp = Math.atan(NaN);
1157 ok(isNaN(tmp), "Math.atan(NaN) is not NaN");
1159 tmp = Math.atan(Infinity);
1160 ok(Math.floor(tmp*100) === 157, "Math.atan(Infinity) = " + tmp);
1162 tmp = Math.atan(-Infinity);
1163 ok(Math.floor(tmp*100) === -158, "Math.atan(Infinity) = " + tmp);
1165 tmp = Math.atan2(0, 0);
1166 ok(Math.floor(tmp*100) === 0, "Math.atan2(0, 0) = " + tmp);
1168 tmp = Math.atan2(0, 1);
1169 ok(Math.floor(tmp*100) === 0, "Math.atan2(0, 1) = " + tmp);
1171 tmp = Math.atan2(0, Infinity);
1172 ok(Math.floor(tmp*100) === 0, "Math.atan2(0, Infinity) = " + tmp);
1174 tmp = Math.atan2(0, -1);
1175 ok(Math.floor(tmp*100) === 314, "Math.atan2(0, -1) = " + tmp);
1177 tmp = Math.atan2(0, -Infinity);
1178 ok(Math.floor(tmp*100) === 314, "Math.atan2(0, -Infinity) = " + tmp);
1180 tmp = Math.atan2(1, 0);
1181 ok(Math.floor(tmp*100) === 157, "Math.atan2(1, 0) = " + tmp);
1183 tmp = Math.atan2(Infinity, 0);
1184 ok(Math.floor(tmp*100) === 157, "Math.atan2(Infinity, 0) = " + tmp);
1186 tmp = Math.atan2(-1, 0);
1187 ok(Math.floor(tmp*100) === -158, "Math.atan2(-1, 0) = " + tmp);
1189 tmp = Math.atan2(-Infinity, 0);
1190 ok(Math.floor(tmp*100) === -158, "Math.atan2(-Infinity, 0) = " + tmp);
1192 tmp = Math.atan2(1, 1);
1193 ok(Math.floor(tmp*100) === 78, "Math.atan2(1, 1) = " + tmp);
1195 tmp = Math.atan2(-1, -1);
1196 ok(Math.floor(tmp*100) === -236, "Math.atan2(-1, -1) = " + tmp);
1198 tmp = Math.atan2(-1, 1);
1199 ok(Math.floor(tmp*100) === -79, "Math.atan2(-1, 1) = " + tmp);
1201 tmp = Math.atan2(Infinity, Infinity);
1202 ok(Math.floor(tmp*100) === 78, "Math.atan2(Infinity, Infinity) = " + tmp);
1204 tmp = Math.atan2(Infinity, -Infinity, 1);
1205 ok(Math.floor(tmp*100) === 235, "Math.atan2(Infinity, -Infinity, 1) = " + tmp);
1208 ok(isNaN(tmp), "Math.atan2() is not NaN");
1210 tmp = Math.atan2(1);
1211 ok(isNaN(tmp), "Math.atan2(1) is not NaN");
1214 ok(tmp === 1, "Math.exp(0) = " + tmp);
1217 ok(Math.floor(tmp*100) === 271, "Math.exp(1) = " + tmp);
1220 ok(Math.floor(tmp*100) === 36, "Math.exp(-1) = " + tmp);
1222 tmp = Math.exp(true);
1223 ok(Math.floor(tmp*100) === 271, "Math.exp(true) = " + tmp);
1225 tmp = Math.exp(1, 1);
1226 ok(Math.floor(tmp*100) === 271, "Math.exp(1, 1) = " + tmp);
1229 ok(isNaN(tmp), "Math.exp() is not NaN");
1231 tmp = Math.exp(NaN);
1232 ok(isNaN(tmp), "Math.exp(NaN) is not NaN");
1234 tmp = Math.exp(Infinity);
1235 ok(tmp === Infinity, "Math.exp(Infinity) = " + tmp);
1237 tmp = Math.exp(-Infinity);
1238 ok(tmp === 0, "Math.exp(-Infinity) = " + tmp);
1241 ok(Math.floor(tmp*100) === 0, "Math.log(1) = " + tmp);
1244 ok(isNaN(tmp), "Math.log(-1) is not NaN");
1246 tmp = Math.log(true);
1247 ok(Math.floor(tmp*100) === 0, "Math.log(true) = " + tmp);
1249 tmp = Math.log(1, 1);
1250 ok(Math.floor(tmp*100) === 0, "Math.log(1, 1) = " + tmp);
1253 ok(isNaN(tmp), "Math.log() is not NaN");
1255 tmp = Math.log(NaN);
1256 ok(isNaN(tmp), "Math.log(NaN) is not NaN");
1258 tmp = Math.log(Infinity);
1259 ok(tmp === Infinity, "Math.log(Infinity) = " + tmp);
1261 tmp = Math.log(-Infinity);
1262 ok(isNaN(tmp), "Math.log(-Infinity) is not NaN");
1265 ok(tmp === 0, "Math.sin(0) = " + tmp);
1267 tmp = Math.sin(Math.PI/2);
1268 ok(tmp === 1, "Math.sin(Math.PI/2) = " + tmp);
1270 tmp = Math.sin(-Math.PI/2);
1271 ok(tmp === -1, "Math.sin(-Math.PI/2) = " + tmp);
1273 tmp = Math.sin(Math.PI/3, 2);
1274 ok(Math.floor(tmp*100) === 86, "Math.sin(Math.PI/3, 2) = " + tmp);
1276 tmp = Math.sin(true);
1277 ok(Math.floor(tmp*100) === 84, "Math.sin(true) = " + tmp);
1279 tmp = Math.sin(false);
1280 ok(tmp === 0, "Math.sin(false) = " + tmp);
1283 ok(isNaN(tmp), "Math.sin() is not NaN");
1285 tmp = Math.sin(NaN);
1286 ok(isNaN(tmp), "Math.sin(NaN) is not NaN");
1288 tmp = Math.sin(Infinity);
1289 ok(isNaN(tmp), "Math.sin(Infinity) is not NaN");
1291 tmp = Math.sin(-Infinity);
1292 ok(isNaN(tmp), "Math.sin(-Infinity) is not NaN");
1295 ok(tmp === 0, "Math.sqrt(0) = " + tmp);
1298 ok(tmp === 2, "Math.sqrt(4) = " + tmp);
1300 tmp = Math.sqrt(-1);
1301 ok(isNaN(tmp), "Math.sqrt(-1) is not NaN");
1303 tmp = Math.sqrt(2, 2);
1304 ok(Math.floor(tmp*100) === 141, "Math.sqrt(2, 2) = " + tmp);
1306 tmp = Math.sqrt(true);
1307 ok(tmp === 1, "Math.sqrt(true) = " + tmp);
1309 tmp = Math.sqrt(false);
1310 ok(tmp === 0, "Math.sqrt(false) = " + tmp);
1313 ok(isNaN(tmp), "Math.sqrt() is not NaN");
1315 tmp = Math.sqrt(NaN);
1316 ok(isNaN(tmp), "Math.sqrt(NaN) is not NaN");
1318 tmp = Math.sqrt(Infinity);
1319 ok(tmp === Infinity, "Math.sqrt(Infinity) = " + tmp);
1321 tmp = Math.sqrt(-Infinity);
1322 ok(isNaN(tmp), "Math.sqrt(-Infinity) is not NaN");
1325 ok(tmp === 0, "Math.tan(0) = " + tmp);
1327 tmp = Math.tan(Math.PI);
1328 ok(Math.floor(tmp*100) === -1, "Math.tan(Math.PI) = " + tmp);
1330 tmp = Math.tan(2, 2);
1331 ok(Math.floor(tmp*100) === -219, "Math.tan(2, 2) = " + tmp);
1333 tmp = Math.tan(true);
1334 ok(Math.floor(tmp*100) === 155, "Math.tan(true) = " + tmp);
1336 tmp = Math.tan(false);
1337 ok(tmp === 0, "Math.tan(false) = " + tmp);
1340 ok(isNaN(tmp), "Math.tan() is not NaN");
1342 tmp = Math.tan(NaN);
1343 ok(isNaN(tmp), "Math.tan(NaN) is not NaN");
1345 tmp = Math.tan(Infinity);
1346 ok(isNaN(tmp), "Math.tan(Infinity) is not NaN");
1348 tmp = Math.tan(-Infinity);
1349 ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN");
1351 var func = function (a) {
1355 ok(func.toString() === "function (a) {\n var a = 1;\n if(a) return;\n }",
1356 "func.toString() = " + func.toString());
1357 ok("" + func === "function (a) {\n var a = 1;\n if(a) return;\n }",
1358 "'' + func.toString() = " + func);
1360 ok(func.valueOf === Object.prototype.valueOf, "func.valueOf !== Object.prototype.valueOf");
1361 ok(func === func.valueOf(), "func !== func.valueOf()");
1363 function testFuncToString(x,y) {
1366 ok(testFuncToString.toString() === "function testFuncToString(x,y) {\n return x+y;\n}",
1367 "testFuncToString.toString() = " + testFuncToString.toString());
1368 ok("" + testFuncToString === "function testFuncToString(x,y) {\n return x+y;\n}",
1369 "'' + testFuncToString = " + testFuncToString);
1373 function callTest(argc) {
1374 ok(this === tmp, "this !== tmp\n");
1375 ok(arguments.length === argc+1, "arguments.length = " + arguments.length + " expected " + (argc+1));
1376 for(var i=1; i <= argc; i++)
1377 ok(arguments[i] === i, "arguments[i] = " + arguments[i]);
1380 callTest.call(tmp, 1, 1);
1381 callTest.call(tmp, 2, 1, 2);
1383 callTest.apply(tmp, [1, 1]);
1384 callTest.apply(tmp, [2, 1, 2]);
1385 (function () { callTest.apply(tmp, arguments); })(2,1,2);
1387 function callTest2() {
1388 ok(this === tmp, "this !== tmp\n");
1389 ok(arguments.length === 0, "callTest2: arguments.length = " + arguments.length + " expected 0");
1392 callTest2.call(tmp);
1393 callTest2.apply(tmp, []);
1394 callTest2.apply(tmp);
1395 (function () { callTest2.apply(tmp, arguments); })();
1397 function callTest3() {
1399 ok(arguments.length === 0, "arguments.length = " + arguments.length + " expected 0");
1403 callTest3.call(undefined);
1404 callTest3.call(null);
1406 callTest3.apply(undefined);
1407 callTest3.apply(null);
1409 tmp = Number.prototype.toString.call(3);
1410 ok(tmp === "3", "Number.prototype.toString.call(3) = " + tmp);
1412 var date = new Date();
1414 date = new Date(100);
1415 ok(date.getTime() === 100, "date.getTime() = " + date.getTime());
1416 ok(Date.prototype.getTime() === 0, "date.prototype.getTime() = " + Date.prototype.getTime());
1417 date = new Date(8.64e15);
1418 ok(date.getTime() === 8.64e15, "date.getTime() = " + date.getTime());
1419 date = new Date(8.64e15+1);
1420 ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
1421 date = new Date(Infinity);
1422 ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
1423 date = new Date("3 July 2009 22:28:00 UTC+0100");
1424 ok(date.getTime() === 1246656480000, "date.getTime() = " + date.getTime());
1425 date = new Date(1984, 11, 29, 13, 51, 24, 120);
1426 ok(date.getFullYear() === 1984, "date.getFullYear() = " + date.getFullYear());
1427 ok(date.getMonth() === 11, "date.getMonth() = " + date.getMonth());
1428 ok(date.getDate() === 29, "date.getDate() = " + date.getDate());
1429 ok(date.getHours() === 13, "date.getHours() = " + date.getHours());
1430 ok(date.getMinutes() === 51, "date.getMinutes() = " + date.getMinutes());
1431 ok(date.getSeconds() === 24, "date.getSeconds() = " + date.getSeconds());
1432 ok(date.getMilliseconds() === 120, "date.getMilliseconds() = " + date.getMilliseconds());
1433 date = new Date(731, -32, 40, -1, 70, 65, -13);
1434 ok(date.getFullYear() === 728, "date.getFullYear() = " + date.getFullYear());
1435 ok(date.getMonth() === 5, "date.getMonth() = " + date.getMonth());
1436 ok(date.getDate() === 9, "date.getDate() = " + date.getDate());
1437 ok(date.getHours() === 0, "date.getHours() = " + date.getHours());
1438 ok(date.getMinutes() === 11, "date.getMinutes() = " + date.getMinutes());
1439 ok(date.getSeconds() === 4, "date.getSeconds() = " + date.getSeconds());
1440 ok(date.getMilliseconds() === 987, "date.getMilliseconds() = " + date.getMilliseconds());
1442 ok(date.setTime(123) === 123, "date.setTime(123) !== 123");
1443 ok(date.setTime("123", NaN) === 123, "date.setTime(\"123\") !== 123");
1444 ok(isNaN(date.setTime(NaN)), "date.setTime(NaN) is not NaN");
1446 ok(date.setTime(0) === date.getTime(), "date.setTime(0) !== date.getTime()");
1447 ok(date.getUTCFullYear() === 1970, "date.getUTCFullYear() = " + date.getUTCFullYear());
1448 ok(date.getUTCMonth() === 0, "date.getUTCMonth() = " + date.getUTCMonth());
1449 ok(date.getUTCDate() === 1, "date.getUTCDate() = " + date.getUTCDate());
1450 ok(date.getUTCDay() === 4, "date.getUTCDay() = " + date.getUTCDay());
1451 ok(date.getUTCHours() === 0, "date.getUTCHours() = " + date.getUTCHours());
1452 ok(date.getUTCMinutes() === 0, "date.getUTCMinutes() = " + date.getUTCMinutes());
1453 ok(date.getUTCSeconds() === 0, "date.getUTCSeconds() = " + date.getUTCSeconds());
1454 ok(date.getUTCMilliseconds() === 0, "date.getUTCMilliseconds() = " + date.getUTCMilliseconds());
1455 date.setTime(60*24*60*60*1000);
1456 ok(date.getUTCFullYear() === 1970, "date.getUTCFullYear() = " + date.getUTCFullYear());
1457 ok(date.getUTCMonth() === 2, "date.getUTCMonth() = " + date.getUTCMonth());
1458 ok(date.getUTCDate() === 2, "date.getUTCDate() = " + date.getUTCDate());
1459 ok(date.getUTCDay() === 1, "date.getUTCDay() = " + date.getUTCDay());
1460 ok(date.getUTCHours() === 0, "date.getUTCHours() = " + date.getUTCHours());
1461 ok(date.getUTCMinutes() === 0, "date.getUTCMinutes() = " + date.getUTCMinutes());
1462 ok(date.getUTCSeconds() === 0, "date.getUTCSeconds() = " + date.getUTCSeconds());
1463 ok(date.getUTCMilliseconds() === 0, "date.getUTCMilliseconds() = " + date.getUTCMilliseconds());
1464 date.setTime(59*24*60*60*1000 + 4*365*24*60*60*1000 + 60*60*1000 + 2*60*1000 + 2*1000 + 640);
1465 ok(date.getUTCFullYear() === 1974, "date.getUTCFullYear() = " + date.getUTCFullYear());
1466 ok(date.getUTCMonth() === 1, "date.getUTCMonth() = " + date.getUTCMonth());
1467 ok(date.getUTCMonth(123) === 1, "date.getUTCMonth() = " + date.getUTCMonth());
1468 ok(date.getUTCDate() === 28, "date.getUTCDate() = " + date.getUTCDate());
1469 ok(date.getUTCDay() === 4, "date.getUTCDay() = " + date.getUTCDay());
1470 ok(date.getUTCHours() === 1, "date.getUTCHours() = " + date.getUTCHours());
1471 ok(date.getUTCMinutes() === 2, "date.getUTCMinutes() = " + date.getUTCMinutes());
1472 ok(date.getUTCSeconds() === 2, "date.getUTCSeconds() = " + date.getUTCSeconds());
1473 ok(date.getUTCMilliseconds() === 640, "date.getUTCMilliseconds() = " + date.getUTCMilliseconds());
1474 date.setTime(Infinity);
1475 ok(isNaN(date.getUTCFullYear()), "date.getUTCFullYear() is not NaN");
1476 ok(isNaN(date.getUTCMonth()), "date.getUTCMonth() is not NaN");
1477 ok(isNaN(date.getUTCDate()), "date.getUTCDate() is not NaN");
1478 ok(isNaN(date.getUTCDay()), "date.getUTCDay() is not NaN");
1479 ok(isNaN(date.getUTCHours()), "date.getUTCHours() is not NaN");
1480 ok(isNaN(date.getUTCMinutes()), "date.getUTCMinutes() is not NaN");
1481 ok(isNaN(date.getUTCSeconds()), "date.getUTCSeconds() is not NaN");
1482 ok(isNaN(date.getUTCMilliseconds()), "date.getUTCMilliseconds() is not NaN");
1483 ok(isNaN(date.setMilliseconds(0)), "date.setMilliseconds() is not NaN");
1486 date.setUTCMilliseconds(-10, 2);
1487 ok(date.getUTCMilliseconds() === 990, "date.getUTCMilliseconds() = " + date.getUTCMilliseconds());
1488 date.setUTCMilliseconds(10);
1489 ok(date.getUTCMilliseconds() === 10, "date.getUTCMilliseconds() = " + date.getUTCMilliseconds());
1490 date.setUTCSeconds(-10);
1491 ok(date.getUTCSeconds() === 50, "date.getUTCSeconds() = " + date.getUTCSeconds());
1492 date.setUTCMinutes(-10);
1493 ok(date.getUTCMinutes() === 50, "date.getUTCMinutes() = " + date.getUTCMinutes());
1494 date.setUTCHours(-10);
1495 ok(date.getUTCHours() === 14, "date.getUTCHours() = " + date.getUTCHours());
1496 date.setUTCHours(-123);
1497 ok(date.getTime() === -612549990, "date.getTime() = " + date.getTime());
1498 date.setUTCHours(20);
1499 ok(date.getUTCHours() === 20, "date.getUTCHours() = " + date.getUTCHours());
1500 date.setUTCDate(32);
1501 ok(date.getUTCDate() === 1, "date.getUTCDate() = " + date.getUTCDate());
1502 date.setUTCMonth(22, 37);
1503 ok(date.getTime() === 60987050010, "date.getTime() = " + date.getTime());
1504 date.setUTCFullYear(83, 21, 321);
1505 ok(date.getTime() === -59464984149990, "date.getTime() = " + date.getTime());
1506 ok(Math.abs(date) === 59464984149990, "Math.abs(date) = " + Math.abs(date));
1507 ok(getVT(date+1) === "VT_BSTR", "getVT(date+1) = " + getVT(date+1));
1509 ok(isNaN(Date.parse()), "Date.parse() is not NaN");
1510 ok(isNaN(Date.parse("")), "Date.parse(\"\") is not NaN");
1511 ok(isNaN(Date.parse("Jan Jan 20 2009")), "Date.parse(\"Jan Jan 20 2009\") is not NaN");
1512 ok(Date.parse("Jan 20 2009 UTC") === 1232409600000, "Date.parse(\"Jan 20 2009 UTC\") = " + Date.parse("Jan 20 2009 UTC"));
1513 ok(Date.parse("Jan 20 2009 GMT") === 1232409600000, "Date.parse(\"Jan 20 2009 GMT\") = " + Date.parse("Jan 20 2009 GMT"));
1514 ok(Date.parse("Jan 20 2009 UTC-0") === 1232409600000, "Date.parse(\"Jan 20 2009 UTC-0\") = " + Date.parse("Jan 20 2009 UTC-0"));
1515 ok(Date.parse("Jan 20 2009 UTC+0000") === 1232409600000, "Date.parse(\"Jan 20 2009 UTC+0000\") = " + Date.parse("Jan 20 2009 UTC+0000"));
1516 ok(Date.parse("Ju 13 79 UTC") === 300672000000, "Date.parse(\"Ju 13 79 UTC\") = " + Date.parse("Ju 13 79 UTC"));
1517 ok(Date.parse("12Au91 UTC") === 681955200000, "Date.parse(\"12Au91 UTC\") = " + Date.parse("12Au91 UTC"));
1518 ok(Date.parse("7/02/17 UTC") === -1656806400000, "Date.parse(\"7/02/17 UTC\") = " + Date.parse("7/02/17 UTC"));
1519 ok(Date.parse("Se001 70 12:31:17 UTC") === 21040277000, "Date.parse(\"Se001 70 12:31:17 UTC\") = " + Date.parse("Se001 70 12:31:17 UTC"));
1520 ok(Date.parse("February 31 UTC, 2000 12:31:17 PM") === 952000277000,
1521 "Date.parse(\"February 31 UTC, 2000 12:31:17 PM\") = " + Date.parse("February 31 UTC, 2000 12:31:17 PM"));
1522 ok(Date.parse("71 11:32AM Dec 12 UTC BC ") === -64346358480000, "Date.parse(\"71 11:32AM Dec 12 UTC BC \") = " + Date.parse("71 11:32AM Dec 12 UTC BC "));
1523 ok(Date.parse("23/71/2000 11::32::UTC") === 1010662320000, "Date.parse(\"23/71/2000 11::32::UTC\") = " + Date.parse("23/71/2000 11::32::UTC"));
1525 ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
1526 ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
1528 ok(Math.floor(Math.PI*100) === 314, "modified Math.PI = " + Math.PI);
1530 ok(typeof(Math.E) === "number", "typeof(Math.E) = " + typeof(Math.E));
1531 ok(Math.floor(Math.E*100) === 271, "Math.E = " + Math.E);
1533 ok(Math.floor(Math.E*100) === 271, "modified Math.E = " + Math.E);
1535 ok(typeof(Math.LOG2E) === "number", "typeof(Math.LOG2E) = " + typeof(Math.LOG2E));
1536 ok(Math.floor(Math.LOG2E*100) === 144, "Math.LOG2E = " + Math.LOG2E);
1537 Math.LOG2E = "test";
1538 ok(Math.floor(Math.LOG2E*100) === 144, "modified Math.LOG2E = " + Math.LOG2E);
1540 ok(typeof(Math.LOG10E) === "number", "typeof(Math.LOG10E) = " + typeof(Math.LOG10E));
1541 ok(Math.floor(Math.LOG10E*100) === 43, "Math.LOG10E = " + Math.LOG10E);
1542 Math.LOG10E = "test";
1543 ok(Math.floor(Math.LOG10E*100) === 43, "modified Math.LOG10E = " + Math.LOG10E);
1545 ok(typeof(Math.LN2) === "number", "typeof(Math.LN2) = " + typeof(Math.LN2));
1546 ok(Math.floor(Math.LN2*100) === 69, "Math.LN2 = " + Math.LN2);
1548 ok(Math.floor(Math.LN2*100) === 69, "modified Math.LN2 = " + Math.LN2);
1550 ok(typeof(Math.LN10) === "number", "typeof(Math.LN10) = " + typeof(Math.LN10));
1551 ok(Math.floor(Math.LN10*100) === 230, "Math.LN10 = " + Math.LN10);
1553 ok(Math.floor(Math.LN10*100) === 230, "modified Math.LN10 = " + Math.LN10);
1555 ok(typeof(Math.SQRT2) === "number", "typeof(Math.SQRT2) = " + typeof(Math.SQRT2));
1556 ok(Math.floor(Math.SQRT2*100) === 141, "Math.SQRT2 = " + Math.SQRT2);
1557 Math.SQRT2 = "test";
1558 ok(Math.floor(Math.SQRT2*100) === 141, "modified Math.SQRT2 = " + Math.SQRT2);
1560 ok(typeof(Math.SQRT1_2) === "number", "typeof(Math.SQRT1_2) = " + typeof(Math.SQRT1_2));
1561 ok(Math.floor(Math.SQRT1_2*100) === 70, "Math.SQRT1_2 = " + Math.SQRT1_2);
1562 Math.SQRT1_2 = "test";
1563 ok(Math.floor(Math.SQRT1_2*100) === 70, "modified Math.SQRT1_2 = " + Math.SQRT1_2);
1565 ok(isNaN.toString() === "\nfunction isNaN() {\n [native code]\n}\n",
1566 "isNaN.toString = '" + isNaN.toString() + "'");
1567 ok(Array.toString() === "\nfunction Array() {\n [native code]\n}\n",
1568 "isNaN.toString = '" + Array.toString() + "'");
1569 ok(Function.toString() === "\nfunction Function() {\n [native code]\n}\n",
1570 "isNaN.toString = '" + Function.toString() + "'");
1571 ok(Function.prototype.toString() === "\nfunction prototype() {\n [native code]\n}\n",
1572 "isNaN.toString = '" + Function.prototype.toString() + "'");
1573 ok("".substr.toString() === "\nfunction substr() {\n [native code]\n}\n",
1574 "''.substr.toString = '" + "".substr.toString() + "'");
1576 var bool = new Boolean();
1577 ok(bool.toString() === "false", "bool.toString() = " + bool.toString());
1578 var bool = new Boolean("false");
1579 ok(bool.toString() === "true", "bool.toString() = " + bool.toString());
1580 ok(bool.valueOf() === Boolean(1), "bool.valueOf() = " + bool.valueOf());
1581 ok(bool.toLocaleString() === bool.toString(), "bool.toLocaleString() = " + bool.toLocaleString());
1583 ok(ActiveXObject instanceof Function, "ActiveXObject is not instance of Function");
1584 ok(ActiveXObject.prototype instanceof Object, "ActiveXObject.prototype is not instance of Object");
1586 ok(Error.prototype !== TypeError.prototype, "Error.prototype === TypeError.prototype");
1587 ok(RangeError.prototype !== TypeError.prototype, "RangeError.prototype === TypeError.prototype");
1588 ok(Error.prototype.toLocaleString === Object.prototype.toLocaleString,
1589 "Error.prototype.toLocaleString !== Object.prototype.toLocaleString");
1591 ok(err.valueOf === Object.prototype.valueOf, "err.valueOf !== Object.prototype.valueOf");
1592 ok(Error.prototype.name === "Error", "Error.prototype.name = " + Error.prototype.name);
1593 ok(err.name === "Error", "err.name = " + err.name);
1594 EvalError.prototype.message = "test";
1595 ok(err.toString !== Object.prototype.toString, "err.toString === Object.prototype.toString");
1596 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "Error"), "err.toString() = " + err.toString());
1597 err = new EvalError();
1598 ok(EvalError.prototype.name === "EvalError", "EvalError.prototype.name = " + EvalError.prototype.name);
1599 ok(err.name === "EvalError", "err.name = " + err.name);
1600 ok(err.toString === Error.prototype.toString, "err.toString !== Error.prototype.toString");
1601 ok(err.message === "", "err.message != ''");
1603 ok(err.message === date, "err.message != date");
1604 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "EvalError: "+err.message),
1605 "err.toString() = " + err.toString());
1606 ok(err.toString !== Object.prototype.toString, "err.toString === Object.prototype.toString");
1607 err = new RangeError();
1608 ok(RangeError.prototype.name === "RangeError", "RangeError.prototype.name = " + RangeError.prototype.name);
1609 ok(err.name === "RangeError", "err.name = " + err.name);
1610 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "RangeError"), "err.toString() = " + err.toString());
1611 err = new ReferenceError();
1612 ok(ReferenceError.prototype.name === "ReferenceError", "ReferenceError.prototype.name = " + ReferenceError.prototype.name);
1613 ok(err.name === "ReferenceError", "err.name = " + err.name);
1614 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "ReferenceError"), "err.toString() = " + err.toString());
1615 err = new SyntaxError();
1616 ok(SyntaxError.prototype.name === "SyntaxError", "SyntaxError.prototype.name = " + SyntaxError.prototype.name);
1617 ok(err.name === "SyntaxError", "err.name = " + err.name);
1618 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "SyntaxError"), "err.toString() = " + err.toString());
1619 err = new TypeError();
1620 ok(TypeError.prototype.name === "TypeError", "TypeError.prototype.name = " + TypeError.prototype.name);
1621 ok(err.name === "TypeError", "err.name = " + err.name);
1622 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "TypeError"), "err.toString() = " + err.toString());
1623 err = new URIError();
1624 ok(URIError.prototype.name === "URIError", "URIError.prototype.name = " + URIError.prototype.name);
1625 ok(err.name === "URIError", "err.name = " + err.name);
1626 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "URIError"), "err.toString() = " + err.toString());
1627 err = new Error("message");
1628 ok(err.message === "message", "err.message !== 'message'");
1629 ok(err.toString() === (invokeVersion < 2 ? "[object Error]" : "Error: message"), "err.toString() = " + err.toString());
1630 err = new Error(123);
1631 ok(err.number === 123, "err.number = " + err.number);
1632 err = new Error(0, "message");
1633 ok(err.number === 0, "err.number = " + err.number);
1634 ok(err.message === "message", "err.message = " + err.message);
1635 ok(err.description === "message", "err.description = " + err.description);
1638 tmp.toString = function() { return "test"; };
1640 tmp = Error.prototype.toString.call(tmp);
1641 ok(tmp === "[object Error]", "Error.prototype.toString.call(tmp) = " + tmp);
1645 ok(err.name === null, "err.name = " + err.name + " expected null");
1646 if(invokeVersion >= 2)
1647 ok(err.toString() === "null", "err.toString() = " + err.toString());
1650 err.message = false;
1651 ok(err.message === false, "err.message = " + err.message + " expected false");
1652 if(invokeVersion >= 2)
1653 ok(err.toString() === "Error: false", "err.toString() = " + err.toString());
1656 err.message = new Object();
1657 err.message.toString = function() { return ""; };
1658 if(invokeVersion >= 2)
1659 ok(err.toString() === "Error", "err.toString() = " + err.toString());
1662 err.message = undefined;
1663 if(invokeVersion >= 2)
1664 ok(err.toString() === "Error", "err.toString() = " + err.toString());
1666 function exception_test(func, type, number) {
1675 ok(ret === type, "Exception test, ret = " + ret + ", expected " + type +". Executed function: " + func.toString());
1676 ok(num === number, "Exception test, num = " + num + ", expected " + number + ". Executed function: " + func.toString());
1678 exception_test(function() {arr.toString = Date.prototype.toString; arr.toString();}, "TypeError", -2146823282);
1679 exception_test(function() {Array(-3);}, "RangeError", -2146823259);
1680 exception_test(function() {arr.toString = Boolean.prototype.toString; arr.toString();}, "TypeError", -2146823278);
1681 exception_test(function() {date.setTime();}, "TypeError", -2146827839);
1682 exception_test(function() {arr.test();}, "TypeError", -2146827850);
1683 exception_test(function() {arr.toString = Number.prototype.toString; arr.toString();}, "TypeError", -2146823287);
1684 exception_test(function() {(new Number(3)).toString(1);}, "TypeError", -2146828283);
1685 exception_test(function() {not_existing_variable.something();}, "TypeError", -2146823279);
1686 exception_test(function() {arr.toString = Function.prototype.toString; arr.toString();}, "TypeError", -2146823286);
1687 exception_test(function() {date();}, "TypeError", -2146823286);
1688 exception_test(function() {arr();}, "TypeError", -2146823286);
1689 exception_test(function() {eval("for(i=0;) {}");}, "SyntaxError", -2146827286);
1690 exception_test(function() {eval("function {};");}, "SyntaxError", -2146827283);
1691 exception_test(function() {eval("if");}, "SyntaxError", -2146827283);
1692 exception_test(function() {eval("do i=0; while");}, "SyntaxError", -2146827283);
1693 exception_test(function() {eval("while");}, "SyntaxError", -2146827283);
1694 exception_test(function() {eval("for");}, "SyntaxError", -2146827283);
1695 exception_test(function() {eval("with");}, "SyntaxError", -2146827283);
1696 exception_test(function() {eval("switch");}, "SyntaxError", -2146827283);
1697 exception_test(function() {eval("if(false");}, "SyntaxError", -2146827282);
1698 exception_test(function() {eval("for(i=0; i<10; i++");}, "SyntaxError", -2146827282);
1699 exception_test(function() {eval("while(true");}, "SyntaxError", -2146827282);
1700 exception_test(function() {test = function() {}}, "ReferenceError", -2146823280);
1701 exception_test(function() {eval("for(i=0")}, "SyntaxError", -2146827284);
1702 exception_test(function() {eval("for(i=0;i<10")}, "SyntaxError", -2146827284);
1703 exception_test(function() {eval("while(")}, "SyntaxError", -2146827286);
1704 exception_test(function() {eval("if(")}, "SyntaxError", -2146827286);
1705 exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273);
1706 exception_test(function() {eval("nonexistingfunc()")}, "TypeError", -2146823281);
1707 exception_test(function() {RegExp(/a/, "g");}, "RegExpError", -2146823271);
1708 exception_test(function() {encodeURI('\udcaa');}, "URIError", -2146823264);
1710 function testThisExcept(func, number) {
1711 exception_test(function() {func.call(new Object())}, "TypeError", number);
1714 function testBoolThis(func) {
1715 testThisExcept(Boolean.prototype[func], -2146823278);
1718 testBoolThis("toString");
1719 testBoolThis("valueOf");
1721 function testDateThis(func) {
1722 testThisExcept(Date.prototype[func], -2146823282);
1725 testDateThis("getDate");
1726 testDateThis("getDay");
1727 testDateThis("getFullYear");
1728 testDateThis("getHours");
1729 testDateThis("getMilliseconds");
1730 testDateThis("getMinutes");
1731 testDateThis("getMonth");
1732 testDateThis("getSeconds");
1733 testDateThis("getTime");
1734 testDateThis("getTimezoneOffset");
1735 testDateThis("getUTCDate");
1736 testDateThis("getUTCDay");
1737 testDateThis("getUTCFullYear");
1738 testDateThis("getUTCHours");
1739 testDateThis("getUTCMilliseconds");
1740 testDateThis("getUTCMinutes");
1741 testDateThis("getUTCMonth");
1742 testDateThis("getUTCSeconds");
1743 testDateThis("setDate");
1744 testDateThis("setFullYear");
1745 testDateThis("setHours");
1746 testDateThis("setMilliseconds");
1747 testDateThis("setMinutes");
1748 testDateThis("setMonth");
1749 testDateThis("setSeconds");
1750 testDateThis("setTime");
1751 testDateThis("setUTCDate");
1752 testDateThis("setUTCFullYear");
1753 testDateThis("setUTCHours");
1754 testDateThis("setUTCMilliseconds");
1755 testDateThis("setUTCMinutes");
1756 testDateThis("setUTCMonth");
1757 testDateThis("setUTCSeconds");
1758 testDateThis("toDateString");
1759 testDateThis("toLocaleDateString");
1760 testDateThis("toLocaleString");
1761 testDateThis("toLocaleTimeString");
1762 testDateThis("toString");
1763 testDateThis("toTimeString");
1764 testDateThis("toUTCString");
1765 testDateThis("valueOf");
1767 function testArrayThis(func) {
1768 testThisExcept(Array.prototype[func], -2146823257);
1771 testArrayThis("toString");
1773 function testFunctionThis(func) {
1774 testThisExcept(Function.prototype[func], -2146823286);
1777 testFunctionThis("toString");
1778 testFunctionThis("call");
1779 testFunctionThis("apply");
1781 function testArrayHostThis(func) {
1782 exception_test(function() { Array.prototype[func].call(testObj); }, "TypeError", -2146823274);
1785 testArrayHostThis("push");
1786 testArrayHostThis("shift");
1787 testArrayHostThis("slice");
1788 testArrayHostThis("splice");
1789 testArrayHostThis("unshift");
1791 function testObjectInherit(obj, constr, ts, tls, vo) {
1792 ok(obj instanceof Object, "obj is not instance of Object");
1793 ok(obj instanceof constr, "obj is not instance of its constructor");
1795 ok(obj.hasOwnProperty === Object.prototype.hasOwnProperty,
1796 "obj.hasOwnProperty !== Object.prototype.hasOwnProprty");
1797 ok(obj.isPrototypeOf === Object.prototype.isPrototypeOf,
1798 "obj.isPrototypeOf !== Object.prototype.isPrototypeOf");
1799 ok(obj.propertyIsEnumerable === Object.prototype.propertyIsEnumerable,
1800 "obj.propertyIsEnumerable !== Object.prototype.propertyIsEnumerable");
1803 ok(obj.toString === Object.prototype.toString,
1804 "obj.toString !== Object.prototype.toString");
1806 ok(obj.toString != Object.prototype.toString,
1807 "obj.toString == Object.prototype.toString");
1810 ok(obj.toLocaleString === Object.prototype.toLocaleString,
1811 "obj.toLocaleString !== Object.prototype.toLocaleString");
1813 ok(obj.toLocaleString != Object.prototype.toLocaleString,
1814 "obj.toLocaleString == Object.prototype.toLocaleString");
1817 ok(obj.valueOf === Object.prototype.valueOf,
1818 "obj.valueOf !== Object.prototype.valueOf");
1820 ok(obj.valueOf != Object.prototype.valueOf,
1821 "obj.valueOf == Object.prototype.valueOf");
1823 ok(obj._test === "test", "obj.test = " + obj._test);
1826 Object.prototype._test = "test";
1827 testObjectInherit(new String("test"), String, false, true, false);
1828 testObjectInherit(/test/g, RegExp, false, true, true);
1829 testObjectInherit(new Number(1), Number, false, false, false);
1830 testObjectInherit(new Date(), Date, false, false, false);
1831 testObjectInherit(new Boolean(true), Boolean, false, true, false);
1832 testObjectInherit(new Array(), Array, false, false, true);
1833 testObjectInherit(new Error(), Error, false, true, true);
1834 testObjectInherit(testObjectInherit, Function, false, true, true);
1835 testObjectInherit(Math, Object, true, true, true);
1837 (function() { testObjectInherit(arguments, Object, true, true, true); })();
1839 function testFunctions(obj, arr) {
1842 for(var i=0; i<arr.length; i++) {
1843 l = obj[arr[i][0]].length;
1844 ok(l === arr[i][1], arr[i][0] + ".length = " + l);
1848 testFunctions(Boolean.prototype, [
1853 testFunctions(Number.prototype, [
1856 ["toExponential", 1],
1857 ["toLocaleString", 0],
1861 testFunctions(String.prototype, [
1878 ["localeCompare", 1],
1890 ["toLocaleLowerCase", 0],
1891 ["toLocaleUpperCase", 0],
1896 testFunctions(RegExp.prototype, [
1902 testFunctions(Date.prototype, [
1907 ["getMilliseconds", 0],
1912 ["getTimezoneOffset", 0],
1915 ["getUTCFullYear", 0],
1917 ["getUTCMilliseconds", 0],
1918 ["getUTCMinutes", 0],
1920 ["getUTCSeconds", 0],
1924 ["setMilliseconds", 1],
1930 ["setUTCFullYear", 3],
1932 ["setUTCMilliseconds", 1],
1933 ["setUTCMinutes", 3],
1935 ["setUTCSeconds", 2],
1936 ["toDateString", 0],
1937 ["toLocaleDateString", 0],
1938 ["toLocaleString", 0],
1939 ["toLocaleTimeString", 0],
1941 ["toTimeString", 0],
1947 testFunctions(Array.prototype, [
1957 ["toLocaleString", 0],
1962 testFunctions(Error.prototype, [
1966 testFunctions(Math, [
1987 testFunctions(Object.prototype, [
1988 ["hasOwnProperty", 1],
1989 ["isPrototypeOf", 1],
1990 ["propertyIsEnumerable", 1],
1991 ["toLocaleString", 0],
1996 testFunctions(Function.prototype, [
2002 ok(ActiveXObject.length == 1, "ActiveXObject.length = " + ActiveXObject.length);
2003 ok(Array.length == 1, "Array.length = " + Array.length);
2004 ok(Boolean.length == 1, "Boolean.length = " + Boolean.length);
2005 ok(CollectGarbage.length == 0, "CollectGarbage.length = " + CollectGarbage.length);
2006 //ok(Date.length == 7, "Date.length = " + Date.length);
2007 ok(Enumerator.length == 7, "Enumerator.length = " + Enumerator.length);
2008 ok(Error.length == 1, "Error.length = " + Error.length);
2009 ok(EvalError.length == 1, "EvalError.length = " + EvalError.length);
2010 ok(Function.length == 1, "Function.length = " + Function.length);
2011 ok(GetObject.length == 2, "GetObject.length = " + GetObject.length);
2012 ok(Number.length == 1, "Number.length = " + Number.length);
2013 ok(Object.length == 0, "Object.length = " + Object.length);
2014 ok(RangeError.length == 1, "RangeError.length = " + RangeError.length);
2015 ok(ReferenceError.length == 1, "ReferenceError.length = " + ReferenceError.length);
2016 ok(RegExp.length == 2, "RegExp.length = " + RegExp.length);
2017 ok(ScriptEngine.length == 0, "ScriptEngine.length = " + ScriptEngine.length);
2018 ok(ScriptEngineBuildVersion.length == 0,
2019 "ScriptEngineBuildVersion.length = " + ScriptEngineBuildVersion.length);
2020 ok(ScriptEngineMajorVersion.length == 0,
2021 "ScriptEngineMajorVersion.length = " + ScriptEngineMajorVersion.length);
2022 ok(ScriptEngineMinorVersion.length == 0,
2023 "ScriptEngineMinorVersion.length = " + ScriptEngineMinorVersion.length);
2024 //ok(String.length == 1, "String.length = " + String.length);
2025 ok(SyntaxError.length == 1, "SyntaxError.length = " + SyntaxError.length);
2026 ok(TypeError.length == 1, "TypeError.length = " + TypeError.length);
2027 ok(URIError.length == 1, "URIError.length = " + URIError.length);
2028 ok(VBArray.length == 1, "VBArray.length = " + VBArray.length);
2029 ok(decodeURI.length == 1, "decodeURI.length = " + decodeURI.length);
2030 ok(decodeURIComponent.length == 1, "decodeURIComponent.length = " + decodeURIComponent.length);
2031 ok(encodeURI.length == 1, "encodeURI.length = " + encodeURI.length);
2032 ok(encodeURIComponent.length == 1, "encodeURIComponent.length = " + encodeURIComponent.length);
2033 ok(escape.length == 1, "escape.length = " + escape.length);
2034 ok(eval.length == 1, "eval.length = " + eval.length);
2035 ok(isFinite.length == 1, "isFinite.length = " + isFinite.length);
2036 ok(isNaN.length == 1, "isNaN.length = " + isNaN.length);
2037 ok(parseFloat.length == 1, "parseFloat.length = " + parseFloat.length);
2038 ok(parseInt.length == 2, "parseInt.length = " + parseInt.length);
2039 ok(unescape.length == 1, "unescape.length = " + unescape.length);