OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 assertEquals(2.5, Math.max(1.5, 2.5)); | 121 assertEquals(2.5, Math.max(1.5, 2.5)); |
122 assertEquals(Infinity, Math.max(Infinity, 0)); | 122 assertEquals(Infinity, Math.max(Infinity, 0)); |
123 assertEquals("-Infinity", String(Math.max(-Infinity, -Infinity))); | 123 assertEquals("-Infinity", String(Math.max(-Infinity, -Infinity))); |
124 assertEquals("Infinity", String(Math.max(Infinity, -Infinity))); | 124 assertEquals("Infinity", String(Math.max(Infinity, -Infinity))); |
125 assertEquals("NaN", String(Math.max(NaN, 1))); | 125 assertEquals("NaN", String(Math.max(NaN, 1))); |
126 assertEquals("Infinity", String(1 / Math.max(0.0, 0.0))); | 126 assertEquals("Infinity", String(1 / Math.max(0.0, 0.0))); |
127 assertEquals("-Infinity", String(1 / Math.max(-0.0, -0.0))); | 127 assertEquals("-Infinity", String(1 / Math.max(-0.0, -0.0))); |
128 assertEquals("Infinity", String(1 / Math.max(0.0, -0.0))); | 128 assertEquals("Infinity", String(1 / Math.max(0.0, -0.0))); |
129 }); | 129 }); |
130 | 130 |
131 test(function mathSin() { | |
132 assertEquals(0.0, Math.sin(0.0)); | |
133 assertTrue(0.8 < Math.sin(1) && Math.sin(1) < 0.9); | |
134 assertEquals("NaN", String(Math.sin(Infinity))); | |
135 assertEquals("NaN", String(Math.sin(-Infinity))); | |
136 assertEquals("NaN", String(Math.sin(NaN))); | |
137 }); | |
138 | |
139 test(function mathCos() { | |
140 assertEquals(1.0, Math.cos(0.0)); | |
141 assertTrue(0.5 < Math.cos(1) && Math.cos(1) < 0.6); | |
142 assertEquals("NaN", String(Math.cos(Infinity))); | |
143 assertEquals("NaN", String(Math.cos(-Infinity))); | |
144 assertEquals("NaN", String(Math.cos(NaN))); | |
145 }); | |
146 | |
147 test(function mathTan() { | |
148 assertEquals(0.0, Math.tan(0.0)); | |
149 assertTrue(1.5 < Math.tan(1) && Math.tan(1) < 1.6); | |
150 assertEquals("NaN", String(Math.tan(Infinity))); | |
151 assertEquals("NaN", String(Math.tan(-Infinity))); | |
152 assertEquals("NaN", String(Math.tan(NaN))); | |
153 }); | |
154 | |
155 test(function mathExp() { | 131 test(function mathExp() { |
156 assertEquals(1.0, Math.exp(0.0)); | 132 assertEquals(1.0, Math.exp(0.0)); |
157 assertTrue(2.7 < Math.exp(1) && Math.exp(1) < 2.8); | 133 assertTrue(2.7 < Math.exp(1) && Math.exp(1) < 2.8); |
158 assertEquals("Infinity", String(Math.exp(Infinity))); | 134 assertEquals("Infinity", String(Math.exp(Infinity))); |
159 assertEquals("0", String(Math.exp(-Infinity))); | 135 assertEquals("0", String(Math.exp(-Infinity))); |
160 assertEquals("NaN", String(Math.exp(NaN))); | 136 assertEquals("NaN", String(Math.exp(NaN))); |
161 }); | 137 }); |
162 | 138 |
163 test(function mathLog() { | 139 test(function mathLog() { |
164 assertEquals(0.0, Math.log(1.0)); | 140 assertEquals(0.0, Math.log(1.0)); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 }); | 234 }); |
259 | 235 |
260 | 236 |
261 test(function int32Mod() { | 237 test(function int32Mod() { |
262 assertEquals(-0, -2147483648 % (-1)); | 238 assertEquals(-0, -2147483648 % (-1)); |
263 }); | 239 }); |
264 | 240 |
265 test(function int32Div() { | 241 test(function int32Div() { |
266 assertEquals(2147483648, -2147483648 / (-1)); | 242 assertEquals(2147483648, -2147483648 / (-1)); |
267 }); | 243 }); |
OLD | NEW |