| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = '15.7.2.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
var SECTION = "15.7.2"; |
| 36 |
var VERSION = "ECMA_1"; |
| 37 |
startTest(); |
| 38 |
var TITLE = "The Number Constructor"; |
| 39 |
|
| 40 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); |
| 46 |
|
| 47 |
new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); |
| 48 |
new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); |
| 49 |
new TestCase(SECTION, |
| 50 |
"NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 51 |
"[object Number]", |
| 52 |
eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 53 |
|
| 54 |
new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor ); |
| 55 |
new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) ); |
| 56 |
new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() ); |
| 57 |
new TestCase(SECTION, |
| 58 |
"NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 59 |
"[object Number]", |
| 60 |
eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 61 |
|
| 62 |
new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor ); |
| 63 |
new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) ); |
| 64 |
new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() ); |
| 65 |
new TestCase(SECTION, |
| 66 |
"NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 67 |
"[object Number]", |
| 68 |
eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 69 |
|
| 70 |
new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor ); |
| 71 |
new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) ); |
| 72 |
new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() ); |
| 73 |
new TestCase(SECTION, |
| 74 |
"NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 75 |
"[object Number]", |
| 76 |
eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 77 |
|
| 78 |
new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor ); |
| 79 |
new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) ); |
| 80 |
new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() ); |
| 81 |
new TestCase(SECTION, |
| 82 |
"NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 83 |
"[object Number]", |
| 84 |
eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 85 |
|
| 86 |
new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor ); |
| 87 |
new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) ); |
| 88 |
new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() ); |
| 89 |
new TestCase(SECTION, |
| 90 |
"NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 91 |
"[object Number]", |
| 92 |
eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 93 |
|
| 94 |
new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor ); |
| 95 |
new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) ); |
| 96 |
new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() ); |
| 97 |
new TestCase(SECTION, |
| 98 |
"NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 99 |
"[object Number]", |
| 100 |
eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 101 |
|
| 102 |
new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor ); |
| 103 |
new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) ); |
| 104 |
new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() ); |
| 105 |
new TestCase(SECTION, |
| 106 |
"NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 107 |
"[object Number]", |
| 108 |
eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 109 |
|
| 110 |
new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor ); |
| 111 |
new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) ); |
| 112 |
new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() ); |
| 113 |
new TestCase(SECTION, |
| 114 |
"NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 115 |
"[object Number]", |
| 116 |
eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 117 |
|
| 118 |
new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor ); |
| 119 |
new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) ); |
| 120 |
new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() ); |
| 121 |
new TestCase(SECTION, |
| 122 |
"NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 123 |
"[object Number]", |
| 124 |
eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 125 |
|
| 126 |
|
| 127 |
new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); |
| 128 |
new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); |
| 129 |
new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); |
| 130 |
new TestCase(SECTION, |
| 131 |
"NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", |
| 132 |
"[object Number]", |
| 133 |
eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); |
| 134 |
|
| 135 |
test(); |