| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = '15.8.2.1.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
var SECTION = "15.8.2.1"; |
| 21 |
var VERSION = "ECMA_1"; |
| 22 |
var TITLE = "Math.abs()"; |
| 23 |
var BUGNUMBER = "77391"; |
| 24 |
startTest(); |
| 25 |
|
| 26 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 27 |
|
| 28 |
new TestCase( SECTION, |
| 29 |
"Math.abs.length", |
| 30 |
1, |
| 31 |
Math.abs.length ); |
| 32 |
|
| 33 |
new TestCase( SECTION, |
| 34 |
"Math.abs()", |
| 35 |
Number.NaN, |
| 36 |
Math.abs() ); |
| 37 |
|
| 38 |
new TestCase( SECTION, |
| 39 |
"Math.abs( void 0 )", |
| 40 |
Number.NaN, |
| 41 |
Math.abs(void 0) ); |
| 42 |
|
| 43 |
new TestCase( SECTION, |
| 44 |
"Math.abs( null )", |
| 45 |
0, |
| 46 |
Math.abs(null) ); |
| 47 |
|
| 48 |
new TestCase( SECTION, |
| 49 |
"Math.abs( true )", |
| 50 |
1, |
| 51 |
Math.abs(true) ); |
| 52 |
|
| 53 |
new TestCase( SECTION, |
| 54 |
"Math.abs( false )", |
| 55 |
0, |
| 56 |
Math.abs(false) ); |
| 57 |
|
| 58 |
new TestCase( SECTION, |
| 59 |
"Math.abs( string primitive)", |
| 60 |
Number.NaN, |
| 61 |
Math.abs("a string primitive") ); |
| 62 |
|
| 63 |
new TestCase( SECTION, |
| 64 |
"Math.abs( string object )", |
| 65 |
Number.NaN, |
| 66 |
Math.abs(new String( 'a String object' )) ); |
| 67 |
|
| 68 |
new TestCase( SECTION, |
| 69 |
"Math.abs( Number.NaN )", |
| 70 |
Number.NaN, |
| 71 |
Math.abs(Number.NaN) ); |
| 72 |
|
| 73 |
new TestCase( SECTION, |
| 74 |
"Math.abs(0)", |
| 75 |
0, |
| 76 |
Math.abs( 0 ) ); |
| 77 |
|
| 78 |
new TestCase( SECTION, |
| 79 |
"Math.abs( -0 )", |
| 80 |
0, |
| 81 |
Math.abs(-0) ); |
| 82 |
|
| 83 |
new TestCase( SECTION, |
| 84 |
"Infinity/Math.abs(-0)", |
| 85 |
Infinity, |
| 86 |
Infinity/Math.abs(-0) ); |
| 87 |
|
| 88 |
new TestCase( SECTION, |
| 89 |
"Math.abs( -Infinity )", |
| 90 |
Number.POSITIVE_INFINITY, |
| 91 |
Math.abs( Number.NEGATIVE_INFINITY ) ); |
| 92 |
|
| 93 |
new TestCase( SECTION, |
| 94 |
"Math.abs( Infinity )", |
| 95 |
Number.POSITIVE_INFINITY, |
| 96 |
Math.abs( Number.POSITIVE_INFINITY ) ); |
| 97 |
|
| 98 |
new TestCase( SECTION, |
| 99 |
"Math.abs( - MAX_VALUE )", |
| 100 |
Number.MAX_VALUE, |
| 101 |
Math.abs( - Number.MAX_VALUE ) ); |
| 102 |
|
| 103 |
new TestCase( SECTION, |
| 104 |
"Math.abs( - MIN_VALUE )", |
| 105 |
Number.MIN_VALUE, |
| 106 |
Math.abs( -Number.MIN_VALUE ) ); |
| 107 |
|
| 108 |
new TestCase( SECTION, |
| 109 |
"Math.abs( MAX_VALUE )", |
| 110 |
Number.MAX_VALUE, |
| 111 |
Math.abs( Number.MAX_VALUE ) ); |
| 112 |
|
| 113 |
new TestCase( SECTION, |
| 114 |
"Math.abs( MIN_VALUE )", |
| 115 |
Number.MIN_VALUE, |
| 116 |
Math.abs( Number.MIN_VALUE ) ); |
| 117 |
|
| 118 |
new TestCase( SECTION, |
| 119 |
"Math.abs( -1 )", |
| 120 |
1, |
| 121 |
Math.abs( -1 ) ); |
| 122 |
|
| 123 |
new TestCase( SECTION, |
| 124 |
"Math.abs( new Number( -1 ) )", |
| 125 |
1, |
| 126 |
Math.abs( new Number(-1) ) ); |
| 127 |
|
| 128 |
new TestCase( SECTION, |
| 129 |
"Math.abs( 1 )", |
| 130 |
1, |
| 131 |
Math.abs( 1 ) ); |
| 132 |
|
| 133 |
new TestCase( SECTION, |
| 134 |
"Math.abs( Math.PI )", |
| 135 |
Math.PI, |
| 136 |
Math.abs( Math.PI ) ); |
| 137 |
|
| 138 |
new TestCase( SECTION, |
| 139 |
"Math.abs( -Math.PI )", |
| 140 |
Math.PI, |
| 141 |
Math.abs( -Math.PI ) ); |
| 142 |
|
| 143 |
new TestCase( SECTION, |
| 144 |
"Math.abs(-1/100000000)", |
| 145 |
1/100000000, |
| 146 |
Math.abs(-1/100000000) ); |
| 147 |
|
| 148 |
new TestCase( SECTION, |
| 149 |
"Math.abs(-Math.pow(2,32))", |
| 150 |
Math.pow(2,32), |
| 151 |
Math.abs(-Math.pow(2,32)) ); |
| 152 |
|
| 153 |
new TestCase( SECTION, |
| 154 |
"Math.abs(Math.pow(2,32))", |
| 155 |
Math.pow(2,32), |
| 156 |
Math.abs(Math.pow(2,32)) ); |
| 157 |
|
| 158 |
new TestCase( SECTION, |
| 159 |
"Math.abs( -0xfff )", |
| 160 |
4095, |
| 161 |
Math.abs( -0xfff ) ); |
| 162 |
|
| 163 |
new TestCase( SECTION, |
| 164 |
"Math.abs( -0777 )", |
| 165 |
511, |
| 166 |
Math.abs(-0777 ) ); |
| 167 |
|
| 168 |
new TestCase( SECTION, |
| 169 |
"Math.abs('-1e-1')", |
| 170 |
0.1, |
| 171 |
Math.abs('-1e-1') ); |
| 172 |
|
| 173 |
new TestCase( SECTION, |
| 174 |
"Math.abs('0xff')", |
| 175 |
255, |
| 176 |
Math.abs('0xff') ); |
| 177 |
|
| 178 |
new TestCase( SECTION, |
| 179 |
"Math.abs('077')", |
| 180 |
77, |
| 181 |
Math.abs('077') ); |
| 182 |
|
| 183 |
new TestCase( SECTION, |
| 184 |
"Math.abs( 'Infinity' )", |
| 185 |
Infinity, |
| 186 |
Math.abs('Infinity') ); |
| 187 |
|
| 188 |
new TestCase( SECTION, |
| 189 |
"Math.abs( '-Infinity' )", |
| 190 |
Infinity, |
| 191 |
Math.abs('-Infinity') ); |
| 192 |
|
| 193 |
test(); |