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
21 ok(true, "true is not true?");
22 ok(!false, "!false is not true");
23 ok(!undefined, "!undefined is not true");
24 ok(!null, "!null is not true");
25 ok(!0, "!0 is not true");
26 ok(!0.0, "!0.0 is not true");
28 ok(1 === 1, "1 === 1 is false");
29 ok(!(1 === 2), "!(1 === 2) is false");
30 ok(1.0 === 1, "1.0 === 1 is false");
31 ok("abc" === "abc", "\"abc\" === \"abc\" is false");
32 ok(true === true, "true === true is false");
33 ok(null === null, "null === null is false");
34 ok(undefined === undefined, "undefined === undefined is false");
35 ok(!(undefined === null), "!(undefined === null) is false");
36 ok(1E0 === 1, "1E0 === 1 is false");
37 ok(1000000*1000000 === 1000000000000, "1000000*1000000 === 1000000000000 is false");
38 ok(8.64e15 === 8640000000000000, "8.64e15 !== 8640000000000000"+8.64e15);
39 ok(1e2147483648 === Infinity, "1e2147483648 !== Infinity");
41 ok(1 !== 2, "1 !== 2 is false");
42 ok(null !== undefined, "null !== undefined is false");
44 ok(1 == 1, "1 == 1 is false");
45 ok(!(1 == 2), "!(1 == 2) is false");
46 ok(1.0 == 1, "1.0 == 1 is false");
47 ok("abc" == "abc", "\"abc\" == \"abc\" is false");
48 ok(true == true, "true == true is false");
49 ok(null == null, "null == null is false");
50 ok(undefined == undefined, "undefined == undefined is false");
51 ok(undefined == null, "undefined == null is false");
52 ok(true == 1, "true == 1 is false");
53 ok(!(true == 2), "true == 2");
54 ok(0 == false, "0 == false is false");
56 ok(1 != 2, "1 != 2 is false");
57 ok(false != 1, "false != 1 is false");
60 ok(trueVar, "trueVar is not true");
62 ok(ScriptEngine.length === 0, "ScriptEngine.length is not 0");
64 function testFunc1(x, y) {
65 ok(this !== undefined, "this is undefined");
66 ok(x === true, "x is not 1");
67 ok(y === "test", "y is not \"test\"");
68 ok(arguments.length === 2, "arguments.length is not 2");
69 ok(arguments["0"] === true, "arguments[0] is not true");
70 ok(arguments["1"] === "test", "arguments[1] is not \"test\"");
75 ok(testFunc1.length === 2, "testFunc1.length is not 2");
77 ok(Object.prototype !== undefined, "Object.prototype is undefined");
78 ok(Object.prototype.prototype === undefined, "Object.prototype is not undefined");
79 ok(String.prototype !== undefined, "String.prototype is undefined");
80 ok(Array.prototype !== undefined, "Array.prototype is undefined");
81 ok(Boolean.prototype !== undefined, "Boolean.prototype is undefined");
82 ok(Number.prototype !== undefined, "Number.prototype is undefined");
83 ok(RegExp.prototype !== undefined, "RegExp.prototype is undefined");
84 ok(Math !== undefined, "Math is undefined");
85 ok(Math.prototype === undefined, "Math.prototype is not undefined");
86 ok(Function.prototype !== undefined, "Function.prototype is undefined");
87 ok(Function.prototype.prototype === undefined, "Function.prototype is not undefined");
88 ok(Date.prototype !== undefined, "Date.prototype is undefined");
89 ok(Date.prototype.prototype === undefined, "Date.prototype is not undefined");
91 Function.prototype.test = true;
92 ok(testFunc1.test === true, "testFunc1.test !== true");
93 ok(Function.test === true, "Function.test !== true");
95 ok(typeof(0) === "number", "typeof(0) is not number");
96 ok(typeof(1.5) === "number", "typeof(1.5) is not number");
97 ok(typeof("abc") === "string", "typeof(\"abc\") is not string");
98 ok(typeof("") === "string", "typeof(\"\") is not string");
99 ok(typeof(true) === "boolean", "typeof(true) is not boolean");
100 ok(typeof(null) === "object", "typeof(null) is not object");
101 ok(typeof(undefined) === "undefined", "typeof(undefined) is not undefined");
102 ok(typeof(Math) === "object", "typeof(Math) is not object");
103 ok(typeof(String.prototype) === "object", "typeof(String.prototype) is not object");
104 ok(typeof(testFunc1) === "function", "typeof(testFunc1) is not function");
105 ok(typeof(String) === "function", "typeof(String) is not function");
106 ok(typeof(ScriptEngine) === "function", "typeof(ScriptEngine) is not function");
107 ok(typeof(this) === "object", "typeof(this) is not object");
109 ok(testFunc1(true, "test") === true, "testFunc1 not returned true");
111 var obj1 = new Object();
112 ok(typeof(obj1) === "object", "typeof(obj1) is not object");
114 obj1.func = function () {
115 ok(this === obj1, "this is not obj1");
116 ok(this.test === true, "this.test is not true");
117 ok(arguments.length === 1, "arguments.length is not 1");
118 ok(arguments["0"] === true, "arguments[0] is not true");
123 ok(obj1.func(true) === "test", "obj1.func(true) is not \"test\"");
125 function testConstr1() {
128 ok(this !== undefined, "this is undefined");
129 ok(arguments.length === 1, "arguments.length is not 1");
130 ok(arguments["0"] === true, "arguments[0] is not 1");
135 testConstr1.prototype.pvar = 1;
137 var obj2 = new testConstr1(true);
138 ok(typeof(obj2) === "object", "typeof(obj2) is not object");
139 ok(obj2.pvar === 1, "obj2.pvar is not 1");
141 testConstr1.prototype.pvar = 2;
142 ok(obj2.pvar === 2, "obj2.pvar is not 2");
145 testConstr1.prototype.pvar = 1;
146 ok(obj2.pvar === 3, "obj2.pvar is not 3");
148 var obj3 = new Object;
149 ok(typeof(obj3) === "object", "typeof(obj3) is not object");
151 for(var iter in "test")
152 ok(false, "unexpected forin call, test = " + iter);
154 for(var iter in null)
155 ok(false, "unexpected forin call, test = " + iter);
157 for(var iter in false)
158 ok(false, "unexpected forin call, test = " + iter);
164 ok(false, "else evaluated");
165 ok(tmp === 1, "tmp !== 1, if not evaluated?");
169 ok(false, "if evaluated");
172 ok(tmp === 1, "tmp !== 1, if not evaluated?");
175 ok(false, "if(false) evaluated");
180 ok(tmp === 1, "tmp !== 1, if(true) not evaluated?");
186 var obj3 = { prop1: 1, prop2: typeof(false) };
187 ok(obj3.prop1 === 1, "obj3.prop1 is not 1");
188 ok(obj3.prop2 === "boolean", "obj3.prop2 is not \"boolean\"");
194 ok(blockVar === 2, "blockVar !== 2");
196 ok((true ? 1 : 2) === 1, "conditional expression true is not 1");
197 ok((0 === 2 ? 1 : 2) === 2, "conditional expression true is not 2");
199 ok(getVT(undefined) === "VT_EMPTY", "getVT(undefined) is not VT_EMPTY");
200 ok(getVT(null) === "VT_NULL", "getVT(null) is not VT_NULL");
201 ok(getVT(0) === "VT_I4", "getVT(0) is not VT_I4");
202 ok(getVT(0.5) === "VT_R8", "getVT(1.5) is not VT_R8");
203 ok(getVT("test") === "VT_BSTR", "getVT(\"test\") is not VT_BSTR");
204 ok(getVT(Math) === "VT_DISPATCH", "getVT(Math) is not VT_DISPATCH");
205 ok(getVT(false) === "VT_BOOL", "getVT(false) is not VT_BOOL");
208 ok(tmp === 4, "2+2 !== 4");
209 ok(getVT(tmp) === "VT_I4", "getVT(2+2) !== VT_I4");
212 ok(tmp === 4.5, "2+2.5 !== 4.5");
213 ok(getVT(tmp) === "VT_R8", "getVT(2+2.5) !== VT_R8");
216 ok(tmp === 4, "1.4+2.5 !== 4");
217 ok(getVT(tmp) === "VT_I4", "getVT(1.5+2.5) !== VT_I4");
220 ok(tmp === 2, "4-2 !== 2");
221 ok(getVT(tmp) === "VT_I4", "getVT(4-2) !== VT_I4");
224 ok(tmp === 2.5, "4.5-2 !== 2.5");
225 ok(getVT(tmp) === "VT_R8", "getVT(4-2) !== VT_R8");
228 ok(tmp === 0-2, "-2 !== 0-2");
229 ok(getVT(tmp) === "VT_I4", "getVT(-2) !== VT_I4");
232 ok(tmp === 6, "2*3 !== 6");
233 ok(getVT(tmp) === "VT_I4", "getVT(2*3) !== VT_I4");
236 ok(tmp === 7, "2*3.5 !== 7");
237 ok(getVT(tmp) === "VT_I4", "getVT(2*3.5) !== VT_I4");
240 ok(tmp === 8.75, "2.5*3.5 !== 8.75");
241 ok(getVT(tmp) === "VT_R8", "getVT(2.5*3.5) !== VT_R8");
244 ok(tmp === 2, "4/2 !== 2");
245 ok(getVT(tmp) === "VT_I4", "getVT(4/2) !== VT_I4");
248 ok(tmp === 3, "4.5/1.5 !== 3");
249 ok(getVT(tmp) === "VT_I4", "getVT(4.5/1.5) !== VT_I4");
252 ok(tmp === 1.5, "3/2 !== 1.5");
253 ok(getVT(tmp) === "VT_R8", "getVT(3/2) !== VT_R8");
256 ok(tmp === 1, "3%2 = " + tmp);
259 ok(tmp ===0, "4%2 = " + tmp);
262 ok(tmp === 0.5, "3.5%1.5 = " + tmp);
265 ok(tmp === 0, "3%true = " + tmp);
268 ok(tmp === "abcd", "\"ab\" + \"cd\" !== \"abcd\"");
271 ok((tmp += 1) === 2, "tmp += 1 !== 2");
272 ok(tmp === 2, "tmp !== 2");
275 ok((tmp -= 1) === 1, "tmp -= 1 !== 1");
276 ok(tmp === 1, "tmp !=== 1");
279 ok((tmp *= 1.5) === 3, "tmp *= 1.5 !== 3");
280 ok(tmp === 3, "tmp !=== 3");
283 ok((tmp /= 2) === 2.5, "tmp /= 2 !== 2.5");
284 ok(tmp === 2.5, "tmp !=== 2.5");
287 ok((tmp %= 2) === 1, "tmp %= 2 !== 1");
288 ok(tmp === 1, "tmp !== 1");
291 ok((tmp <<= 1) === 16, "tmp <<= 1 !== 16");
294 ok((tmp >>= 1) === 4, "tmp >>= 1 !== 4");
297 ok((tmp >>>= 1) === 4, "tmp >>>= 1 !== 4");
299 tmp = 3 || ok(false, "second or expression called");
300 ok(tmp === 3, "3 || (...) is not 3");
303 ok(tmp === 2, "false || 2 is not 2");
305 tmp = 0 && ok(false, "second and expression called");
306 ok(tmp === 0, "0 && (...) is not 0");
308 tmp = true && "test";
309 ok(tmp === "test", "true && \"test\" is not \"test\"");
312 ok(tmp === 0, "true && 0 is not 0");
315 ok(tmp === 7, "3 | 4 !== 7");
316 ok(getVT(tmp) === "VT_I4", "getVT(3|4) = " + getVT(tmp));
319 ok(tmp === 3, "3.5 | 0 !== 3");
320 ok(getVT(tmp) === "VT_I4", "getVT(3.5|0) = " + getVT(tmp));
323 ok(tmp === -3, "-3.5 | 0 !== -3");
324 ok(getVT(tmp) === "VT_I4", "getVT(3.5|0) = " + getVT(tmp));
327 ok((tmp |= 0x10) === 26, "tmp(10) |= 0x10 !== 26");
328 ok(getVT(tmp) === "VT_I4", "getVT(tmp |= 10) = " + getVT(tmp));
331 ok(tmp === 1, "3 & 5 !== 1");
332 ok(getVT(tmp) === "VT_I4", "getVT(3|5) = " + getVT(tmp));
335 ok(tmp === 3, "3.5 & 0xffff !== 3 ");
336 ok(getVT(tmp) === "VT_I4", "getVT(3.5&0xffff) = " + getVT(tmp));
338 tmp = (-3.5) & 0xffffffff;
339 ok(tmp === -3, "-3.5 & 0xffff !== -3");
340 ok(getVT(tmp) === "VT_I4", "getVT(3.5&0xffff) = " + getVT(tmp));
343 ok(tmp === 16, "2 << 3 = " + tmp);
346 ok(tmp === 16, "2 << 35 = " + tmp);
349 ok(tmp === 2, "8 >> 2 = " + tmp);
352 ok(tmp === -4, "-64 >> 4 = " + tmp);
355 ok(tmp === 2, "8 >> 2 = " + tmp);
358 ok(tmp === 0x0ffffffc, "-64 >>> 4 = " + tmp);
361 ok((tmp &= 8) === 8, "tmp(10) &= 8 !== 8");
362 ok(getVT(tmp) === "VT_I4", "getVT(tmp &= 8) = " + getVT(tmp));
365 ok(tmp === 0x0ff0, "0xf0f0^0xff00 !== 0x0ff0");
366 ok(getVT(tmp) === "VT_I4", "getVT(0xf0f0^0xff00) = " + getVT(tmp));
369 ok((tmp ^= 3) === 6, "tmp(5) ^= 3 !== 6");
370 ok(getVT(tmp) === "VT_I4", "getVT(tmp ^= 3) = " + getVT(tmp));
373 ok(tmp === -2, "~1 !== -2");
374 ok(getVT(tmp) === "VT_I4", "getVT(~1) = " + getVT(tmp));
376 ok((3,4) === 4, "(3,4) !== 4");
378 ok(+3 === 3, "+3 !== 3");
379 ok(+true === 1, "+true !== 1");
380 ok(+false === 0, "+false !== 0");
381 ok(+null === 0, "+null !== 0");
382 ok(+"0" === 0, "+'0' !== 0");
383 ok(+"3" === 3, "+'3' !== 3");
384 ok(+"-3" === -3, "+'-3' !== -3");
385 ok(+"0xff" === 255, "+'0xff' !== 255");
386 ok(+"3e3" === 3000, "+'3e3' !== 3000");
389 ok(+tmp === 1, "ToNumber(new Number(1)) = " + (+tmp));
390 tmp = new String("1");
391 ok(+tmp === 1, "ToNumber(new String('1')) = " + (+tmp));
393 ok("" + 0 === "0", "\"\" + 0 !== \"0\"");
394 ok("" + 123 === "123", "\"\" + 123 !== \"123\"");
395 ok("" + (-5) === "-5", "\"\" + (-5) !== \"-5\"");
396 ok("" + null === "null", "\"\" + null !== \"null\"");
397 ok("" + undefined === "undefined", "\"\" + undefined !== \"undefined\"");
398 ok("" + true === "true", "\"\" + true !== \"true\"");
399 ok("" + false === "false", "\"\" + false !== \"false\"");
400 ok("" + 0.5 === "0.5", "'' + 0.5 = " + 0.5);
401 ok("" + (-0.5432) === "-0.5432", "'' + (-0.5432) = " + (-0.5432));
403 ok(1 < 3.4, "1 < 3.4 failed");
404 ok(!(3.4 < 1), "3.4 < 1");
405 ok("abc" < "abcd", "abc < abcd failed");
406 ok("abcd" < "abce", "abce < abce failed");
407 ok("" < "x", "\"\" < \"x\" failed");
408 ok(!(0 < 0), "0 < 0");
410 ok(1 <= 3.4, "1 <= 3.4 failed");
411 ok(!(3.4 <= 1), "3.4 <= 1");
412 ok("abc" <= "abcd", "abc <= abcd failed");
413 ok("abcd" <= "abce", "abce <= abce failed");
414 ok("" <= "x", "\"\" <= \"x\" failed");
415 ok(0 <= 0, "0 <= 0 failed");
417 ok(3.4 > 1, "3.4 > 1 failed");
418 ok(!(1 > 3.4), "1 > 3.4");
419 ok("abcd" > "abc", "abc > abcd failed");
420 ok("abce" > "abcd", "abce > abce failed");
421 ok("x" > "", "\"x\" > \"\" failed");
422 ok(!(0 > 0), "0 > 0");
424 ok(3.4 >= 1, "3.4 >= 1 failed");
425 ok(!(1 >= 3.4), "1 >= 3.4");
426 ok("abcd" >= "abc", "abc >= abcd failed");
427 ok("abce" >= "abcd", "abce >= abce failed");
428 ok("x" >= "", "\"x\" >= \"\" failed");
429 ok(0 >= 0, "0 >= 0");
432 ok(++tmp === 2, "++tmp (1) is not 2");
433 ok(tmp === 2, "incremented tmp is not 2");
434 ok(--tmp === 1, "--tmp (2) is not 1");
435 ok(tmp === 1, "decremented tmp is not 1");
436 ok(tmp++ === 1, "tmp++ (1) is not 1");
437 ok(tmp === 2, "incremented tmp(1) is not 2");
438 ok(tmp-- === 2, "tmp-- (2) is not 2");
439 ok(tmp === 1, "decremented tmp is not 1");
441 String.prototype.test = true;
442 ok("".test === true, "\"\".test is not true");
444 Boolean.prototype.test = true;
445 ok(true.test === true, "true.test is not true");
447 Number.prototype.test = true;
448 ok((0).test === true, "(0).test is not true");
449 ok((0.5).test === true, "(0.5).test is not true");
453 ok(state === "", "try: state = " + state);
456 ok(false, "unexpected catch");
458 ok(state === "try", "state = " + state + " expected try");
462 ok(state === "", "try: state = " + state);
465 ok(state === "try", "funally: state = " + state);
468 ok(state === "finally", "state = " + state + " expected finally");
472 ok(state === "", "try: state = " + state);
475 ok(false, "unexpected catch");
477 ok(state === "try", "funally: state = " + state);
480 ok(state === "finally", "state = " + state + " expected finally");
484 ok(state === "", "try: state = " + state);
488 ok(state === "try", "catch: state = " + state);
489 ok(ex === "except", "ex is not \"except\"");
492 ok(state === "catch", "state = " + state + " expected catch");
496 ok(state === "", "try: state = " + state);
500 ok(state === "try", "catch: state = " + state);
501 ok(ex === true, "ex is not true");
504 ok(state === "catch", "funally: state = " + state);
507 ok(state === "finally", "state = " + state + " expected finally");
511 ok(state === "", "try: state = " + state);
513 try { throw true; } finally {}
515 ok(state === "try", "catch: state = " + state);
516 ok(ex === true, "ex is not true");
519 ok(state === "catch", "funally: state = " + state);
522 ok(state === "finally", "state = " + state + " expected finally");
526 ok(state === "", "try: state = " + state);
528 try { throw "except"; } catch(ex) { throw true; }
530 ok(state === "try", "catch: state = " + state);
531 ok(ex === true, "ex is not true");
534 ok(state === "catch", "funally: state = " + state);
537 ok(state === "finally", "state = " + state + " expected finally");
539 function throwFunc(x) {
545 ok(state === "", "try: state = " + state);
549 ok(state === "try", "catch: state = " + state);
550 ok(ex === true, "ex is not true");
553 ok(state === "catch", "funally: state = " + state);
556 ok(state === "finally", "state = " + state + " expected finally");
561 ok(false, "unexpected case \"1\"");
563 ok(state === "", "case 1: state = " + state);
566 ok(state === "1", "default: state = " + state);
569 ok(state === "default", "case false: state = " + state);
572 ok(state === "false", "state = " + state);
578 ok(false, "unexpected case 1");
580 ok(state === "", "default: state = " + state);
583 ok(state === "default", "case false: state = " + state);
586 ok(state === "false", "state = " + state);
591 ok(false, "unexpected case \"1\"");
593 ok(state === "", "case 1: state = " + state);
596 ok(state === "1", "default: state = " + state);
600 ok(false, "unexpected case false");
602 ok(state === "default", "state = " + state);
605 ok(tmp === 1, "eval(\"1\") !== 1");
606 eval("{ ok(tmp === 1, 'eval: tmp !== 1'); } tmp = 2;");
607 ok(tmp === 2, "tmp !== 2");
609 ok(eval(false) === false, "eval(false) !== false");
610 ok(eval() === undefined, "eval() !== undefined");
612 tmp = eval("1", "2");
613 ok(tmp === 1, "eval(\"1\", \"2\") !== 1");
617 ok(state === "", "try: state = " + state);
619 eval("throwFunc(true);");
621 ok(state === "try", "catch: state = " + state);
622 ok(ex === true, "ex is not true");
625 ok(state === "catch", "funally: state = " + state);
628 ok(state === "finally", "state = " + state + " expected finally");
630 tmp = [,,1,2,,,true];
631 ok(tmp.length === 7, "tmp.length !== 7");
632 ok(tmp["0"] === undefined, "tmp[0] is not undefined");
633 ok(tmp["3"] === 2, "tmp[3] !== 2");
634 ok(tmp["6"] === true, "tmp[6] !== true");
635 ok(tmp[2] === 1, "tmp[2] !== 1");
637 ok([1,].length === 2, "[1,].length !== 2");
638 ok([,,].length === 3, "[,,].length !== 3");
639 ok([,].length === 2, "[].length != 2");
640 ok([].length === 0, "[].length != 0");
644 ok(tmp < 4, "tmp >= 4");
647 ok(tmp === 4, "tmp !== 4");
651 ok(tmp < 4, "tmp >= 4");
655 ok(false, "break did not break");
658 ok(tmp === 4, "tmp !== 4");
662 ok(tmp < 4, "tmp >= 4");
665 ok(tmp === 4, "tmp !== 4");
669 ok(tmp === 0, "tmp !=== 0");
672 ok(tmp === 1, "tmp !== 1");
679 ok(false, "break did not break");
681 ok(tmp <= 4 && tmp != 2, "tmp = " + tmp);
683 ok(tmp === 4, "tmp !== 4");
685 for(tmp=0; tmp < 4; tmp++)
686 ok(tmp < 4, "tmp = " + tmp);
687 ok(tmp === 4, "tmp !== 4");
689 for(tmp=0; tmp < 4; tmp++) {
692 ok(tmp < 2, "tmp = " + tmp);
694 ok(tmp === 2, "tmp !== 2");
696 for(tmp=0; tmp < 4; tmp++) {
699 ok(tmp < 4 && tmp != 2, "tmp = " + tmp);
701 ok(tmp === 4, "tmp !== 4");
703 for(var fi=0; fi < 4; fi++)
704 ok(fi < 4, "fi = " + fi);
705 ok(fi === 4, "fi !== 4");
707 ok((void 1) === undefined, "(void 1) !== undefined");
709 var inobj = new Object();
711 for(var iter in inobj)
712 ok(false, "unexpected iter = " + iter);
717 ok(iter == "test", "unexpected iter = " + iter);
720 ok(tmp === 1, "for..in tmp = " + tmp);
722 function forinTestObj() {}
724 forinTestObj.prototype.test3 = true;
726 var arr = new Array();
727 inobj = new forinTestObj();
737 ok(tmp === 3, "for..in tmp = " + tmp);
738 ok(arr["test1"] === true, "arr[test1] !== true");
739 ok(arr["test2"] === true, "arr[test2] !== true");
740 ok(arr["test3"] === true, "arr[test3] !== true");
744 ok((delete tmp.test) === true, "delete returned false");
745 ok(typeof(tmp.test) === "undefined", "tmp.test type = " + typeof(tmp.test));
747 ok(false, "tmp has prop " + iter);
751 ok(testWith === true, "testWith !== true");
757 ok(varTest1 === undefined, "varTest1 = " + varTest1);
758 ok(varTest2 === undefined, "varTest2 = " + varTest1);
762 function varTestFunc(varTest3) {
765 ok(varTest3 === 3, "varTest3 = " + varTest3);
766 ok(varTest4 === undefined, "varTest4 = " + varTest4);
777 ok(false, "deleteTest not throwed exception?");
782 ok(false, "if evaluated");
784 ok(false, "else should be associated with nearest if statement");
788 ok(false, "if evaluated");
790 ok(true, "else should be associated with nearest if statement");
792 ok(isNaN(NaN) === true, "isNaN(NaN) !== true");
793 ok(isNaN(0.5) === false, "isNaN(0.5) !== false");
794 ok(isNaN(Infinity) === false, "isNaN(Infinity) !== false");
795 ok(isNaN() === true, "isNaN() !== true");
796 ok(isNaN(NaN, 0) === true, "isNaN(NaN, 0) !== true");
797 ok(isNaN(0.5, NaN) === false, "isNaN(0.5, NaN) !== false");
798 ok(isNaN(+undefined) === true, "isNaN(+undefined) !== true");
800 ok(isFinite(0.5) === true, "isFinite(0.5) !== true");
801 ok(isFinite(Infinity) === false, "isFinite(Infinity) !== fals");
802 ok(isFinite(-Infinity) === false, "isFinite(Infinity) !== fals");
803 ok(isFinite(NaN) === false, "isFinite(NaN) !== false");
804 ok(isFinite(0.5, NaN) === true, "isFinite(0.5, NaN) !== true");
805 ok(isFinite(NaN, 0.5) === false, "isFinite(NaN, 0.5) !== false");
806 ok(isFinite() === false, "isFinite() !== false");
808 ok((1 < NaN) === false, "(1 < NaN) !== false");
809 ok((1 > NaN) === false, "(1 > NaN) !== false");
810 ok((1 <= NaN) === false, "(1 <= NaN) !== false");
811 ok((1 >= NaN) === false, "(1 >= NaN) !== false");
812 ok((NaN < 1) === false, "(NaN < 1) !== false");
813 ok((NaN > 1) === false, "(NaN > 1) !== false");
814 ok((NaN <= 1) === false, "(NaN <= 1) !== false");
815 ok((NaN >= 1) === false, "(NaN >= 1) !== false");
816 ok((Infinity < 2) === false, "(Infinity < 2) !== false");
817 ok((Infinity > 2) === true, "(Infinity > 2) !== true");
818 ok((-Infinity < 2) === true, "(-Infinity < 2) !== true");
820 ok(isNaN(+"test") === true, "isNaN(+'test') !== true");
821 ok(isNaN(+"123t") === true, "isNaN(+'123t') !== true");
822 ok(isNaN(+"Infinity x") === true, "isNaN(+'Infinity x') !== true");
823 ok(+"Infinity" === Infinity, "+'Infinity' !== Infinity");
824 ok(+" Infinity " === Infinity, "+' Infinity ' !== Infinity");
825 ok(+"-Infinity" === -Infinity, "+'-Infinity' !== -Infinity");
827 ok((NaN !== NaN) === true, "(NaN !== NaN) !== true");
828 ok((NaN === NaN) === false, "(NaN === NaN) !== false");
829 ok((Infinity !== NaN) === true, "(Infinity !== NaN) !== true");
830 ok((Infinity !== NaN) === true, "(Infinity !== NaN) !== true");
831 ok((0 === NaN) === false, "(0 === NaN) !== false");
833 ok((NaN != NaN) === true, "(NaN !== NaN) != true");
834 ok((NaN == NaN) === false, "(NaN === NaN) != false");
835 ok((Infinity != NaN) === true, "(Infinity != NaN) !== true");
836 ok((Infinity != NaN) === true, "(Infinity != NaN) !== true");
837 ok((0 == NaN) === false, "(0 === NaN) != false");
840 ok(typeof(testFunc2) === "function", "typeof(testFunc2) = " + typeof(testFunc2));
842 ok(tmp === 2, "testFunc2(1) = " + tmp);
843 function testFunc2(x) { return x+1; }
845 ok(typeof(testFunc3) === "function", "typeof(testFunc3) = " + typeof(testFunc3));
847 ok(tmp === 3, "testFunc3(1) = " + tmp);
848 tmp = function testFunc3(x) { return x+2; };
851 ok(tmp === 5, "testFunc4(1) = " + tmp);
852 tmp = function testFunc4(x) { return x+3; };
855 ok(testFunc4 === 1, "testFunc4 = " + testFunc4);
856 ok(tmp === 5, "testFunc4(1) = " + tmp);
857 tmp = function testFunc4(x) { return x+4; };
858 ok(testFunc4 === 1, "testFunc4 = " + testFunc4);
860 function testEmbededFunctions() {
861 ok(typeof(testFunc5) === "function", "typeof(testFunc5) = " + typeof(testFunc5));
863 ok(tmp === 3, "testFunc5(1) = " + tmp);
864 tmp = function testFunc5(x) { return x+2; };
867 ok(tmp === 5, "testFunc6(1) = " + tmp);
868 tmp = function testFunc6(x) { return x+3; };
870 ok(tmp === 5, "testFunc6(1) = " + tmp);
871 tmp = function testFunc6(x) { return x+4; };
873 ok(testFunc6 === 1, "testFunc4 = " + testFunc6);
876 testEmbededFunctions();