| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = '15.8.2.9.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
var SECTION = "15.8.2.9"; |
| 28 |
var VERSION = "ECMA_1"; |
| 29 |
startTest(); |
| 30 |
var TITLE = "Math.floor(x)"; |
| 31 |
|
| 32 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 33 |
|
| 34 |
new TestCase( SECTION, |
| 35 |
"Math.floor.length", |
| 36 |
1, |
| 37 |
Math.floor.length ); |
| 38 |
|
| 39 |
new TestCase( SECTION, |
| 40 |
"Math.floor()", |
| 41 |
Number.NaN, |
| 42 |
Math.floor() ); |
| 43 |
|
| 44 |
new TestCase( SECTION, |
| 45 |
"Math.floor(void 0)", |
| 46 |
Number.NaN, |
| 47 |
Math.floor(void 0) ); |
| 48 |
|
| 49 |
new TestCase( SECTION, |
| 50 |
"Math.floor(null)", |
| 51 |
0, |
| 52 |
Math.floor(null) ); |
| 53 |
|
| 54 |
new TestCase( SECTION, |
| 55 |
"Math.floor(true)", |
| 56 |
1, |
| 57 |
Math.floor(true) ); |
| 58 |
|
| 59 |
new TestCase( SECTION, |
| 60 |
"Math.floor(false)", |
| 61 |
0, |
| 62 |
Math.floor(false) ); |
| 63 |
|
| 64 |
new TestCase( SECTION, |
| 65 |
"Math.floor('1.1')", |
| 66 |
1, |
| 67 |
Math.floor("1.1") ); |
| 68 |
|
| 69 |
new TestCase( SECTION, |
| 70 |
"Math.floor('-1.1')", |
| 71 |
-2, |
| 72 |
Math.floor("-1.1") ); |
| 73 |
|
| 74 |
new TestCase( SECTION, |
| 75 |
"Math.floor('0.1')", |
| 76 |
0, |
| 77 |
Math.floor("0.1") ); |
| 78 |
|
| 79 |
new TestCase( SECTION, |
| 80 |
"Math.floor('-0.1')", |
| 81 |
-1, |
| 82 |
Math.floor("-0.1") ); |
| 83 |
|
| 84 |
new TestCase( SECTION, |
| 85 |
"Math.floor(NaN)", |
| 86 |
Number.NaN, |
| 87 |
Math.floor(Number.NaN) ); |
| 88 |
|
| 89 |
new TestCase( SECTION, |
| 90 |
"Math.floor(NaN)==-Math.ceil(-NaN)", |
| 91 |
false, |
| 92 |
Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) ); |
| 93 |
|
| 94 |
new TestCase( SECTION, |
| 95 |
"Math.floor(0)", |
| 96 |
0, |
| 97 |
Math.floor(0) ); |
| 98 |
|
| 99 |
new TestCase( SECTION, |
| 100 |
"Math.floor(0)==-Math.ceil(-0)", |
| 101 |
true, |
| 102 |
Math.floor(0) == -Math.ceil(-0) ); |
| 103 |
|
| 104 |
new TestCase( SECTION, |
| 105 |
"Math.floor(-0)", |
| 106 |
-0, |
| 107 |
Math.floor(-0) ); |
| 108 |
|
| 109 |
new TestCase( SECTION, |
| 110 |
"Infinity/Math.floor(-0)", |
| 111 |
-Infinity, |
| 112 |
Infinity/Math.floor(-0) ); |
| 113 |
|
| 114 |
new TestCase( SECTION, |
| 115 |
"Math.floor(-0)==-Math.ceil(0)", |
| 116 |
true, |
| 117 |
Math.floor(-0)== -Math.ceil(0) ); |
| 118 |
|
| 119 |
new TestCase( SECTION, |
| 120 |
"Math.floor(Infinity)", |
| 121 |
Number.POSITIVE_INFINITY, |
| 122 |
Math.floor(Number.POSITIVE_INFINITY) ); |
| 123 |
|
| 124 |
new TestCase( SECTION, |
| 125 |
"Math.floor(Infinity)==-Math.ceil(-Infinity)", |
| 126 |
true, |
| 127 |
Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) ); |
| 128 |
|
| 129 |
new TestCase( SECTION, |
| 130 |
"Math.floor(-Infinity)", |
| 131 |
Number.NEGATIVE_INFINITY, |
| 132 |
Math.floor(Number.NEGATIVE_INFINITY) ); |
| 133 |
|
| 134 |
new TestCase( SECTION, |
| 135 |
"Math.floor(-Infinity)==-Math.ceil(Infinity)", |
| 136 |
true, |
| 137 |
Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) ); |
| 138 |
|
| 139 |
new TestCase( SECTION, |
| 140 |
"Math.floor(0.0000001)", |
| 141 |
0, |
| 142 |
Math.floor(0.0000001) ); |
| 143 |
|
| 144 |
new TestCase( SECTION, |
| 145 |
"Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, |
| 146 |
Math.floor(0.0000001)==-Math.ceil(-0.0000001) ); |
| 147 |
|
| 148 |
new TestCase( SECTION, |
| 149 |
"Math.floor(-0.0000001)", |
| 150 |
-1, |
| 151 |
Math.floor(-0.0000001) ); |
| 152 |
|
| 153 |
new TestCase( SECTION, |
| 154 |
"Math.floor(0.0000001)==-Math.ceil(0.0000001)", |
| 155 |
true, |
| 156 |
Math.floor(-0.0000001)==-Math.ceil(0.0000001) ); |
| 157 |
|
| 158 |
test(); |