| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library math_test; | 5 library math_test; |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 8 | 8 |
| 9 class MathTest { | 9 class MathTest { |
| 10 static void testConstants() { | 10 static void testConstants() { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 Expect.equals(0xABCDEF, int.parse(" 0x00000ABCDEF ")); | 199 Expect.equals(0xABCDEF, int.parse(" 0x00000ABCDEF ")); |
| 200 Expect.equals(-0xabcdef, int.parse(" -0x00000abcdef ")); | 200 Expect.equals(-0xabcdef, int.parse(" -0x00000abcdef ")); |
| 201 Expect.equals(-0xABCDEF, int.parse(" -0x00000ABCDEF ")); | 201 Expect.equals(-0xABCDEF, int.parse(" -0x00000ABCDEF ")); |
| 202 Expect.equals(10, int.parse("010")); | 202 Expect.equals(10, int.parse("010")); |
| 203 Expect.equals(-10, int.parse("-010")); | 203 Expect.equals(-10, int.parse("-010")); |
| 204 Expect.equals(10, int.parse(" 010 ")); | 204 Expect.equals(10, int.parse(" 010 ")); |
| 205 Expect.equals(-10, int.parse(" -010 ")); | 205 Expect.equals(-10, int.parse(" -010 ")); |
| 206 Expect.equals(9, int.parse("09")); | 206 Expect.equals(9, int.parse("09")); |
| 207 Expect.equals(9, int.parse(" 09 ")); | 207 Expect.equals(9, int.parse(" 09 ")); |
| 208 Expect.equals(-9, int.parse("-09")); | 208 Expect.equals(-9, int.parse("-09")); |
| 209 Expect.equals(0x1234567890, int.parse("+0x1234567890")); |
| 210 Expect.equals(0x1234567890,int.parse(" +0x1234567890 ")); |
| 211 Expect.equals(0x100, int.parse("+0x100")); |
| 212 Expect.equals(0x100, int.parse(" +0x100 ")); |
| 209 Expect.equals(true, parseIntThrowsFormatException("1b")); | 213 Expect.equals(true, parseIntThrowsFormatException("1b")); |
| 210 Expect.equals(true, parseIntThrowsFormatException(" 1b ")); | 214 Expect.equals(true, parseIntThrowsFormatException(" 1b ")); |
| 211 Expect.equals(true, parseIntThrowsFormatException(" 1 b ")); | 215 Expect.equals(true, parseIntThrowsFormatException(" 1 b ")); |
| 212 Expect.equals(true, parseIntThrowsFormatException("1e2")); | 216 Expect.equals(true, parseIntThrowsFormatException("1e2")); |
| 213 Expect.equals(true, parseIntThrowsFormatException(" 1e2 ")); | 217 Expect.equals(true, parseIntThrowsFormatException(" 1e2 ")); |
| 214 Expect.equals(true, parseIntThrowsFormatException("00x12")); | 218 Expect.equals(true, parseIntThrowsFormatException("00x12")); |
| 215 Expect.equals(true, parseIntThrowsFormatException(" 00x12 ")); | 219 Expect.equals(true, parseIntThrowsFormatException(" 00x12 ")); |
| 216 Expect.equals(true, parseIntThrowsFormatException("-1b")); | 220 Expect.equals(true, parseIntThrowsFormatException("-1b")); |
| 217 Expect.equals(true, parseIntThrowsFormatException(" -1b ")); | 221 Expect.equals(true, parseIntThrowsFormatException(" -1b ")); |
| 218 Expect.equals(true, parseIntThrowsFormatException(" -1 b ")); | 222 Expect.equals(true, parseIntThrowsFormatException(" -1 b ")); |
| 219 Expect.equals(true, parseIntThrowsFormatException("-1e2")); | 223 Expect.equals(true, parseIntThrowsFormatException("-1e2")); |
| 220 Expect.equals(true, parseIntThrowsFormatException(" -1e2 ")); | 224 Expect.equals(true, parseIntThrowsFormatException(" -1e2 ")); |
| 221 Expect.equals(true, parseIntThrowsFormatException("-00x12")); | 225 Expect.equals(true, parseIntThrowsFormatException("-00x12")); |
| 222 Expect.equals(true, parseIntThrowsFormatException(" -00x12 ")); | 226 Expect.equals(true, parseIntThrowsFormatException(" -00x12 ")); |
| 223 Expect.equals(true, parseIntThrowsFormatException(" -00x12 ")); | 227 Expect.equals(true, parseIntThrowsFormatException(" -00x12 ")); |
| 224 Expect.equals(true, parseIntThrowsFormatException("0x0x12")); | 228 Expect.equals(true, parseIntThrowsFormatException("0x0x12")); |
| 225 Expect.equals(true, parseIntThrowsFormatException("0.1")); | 229 Expect.equals(true, parseIntThrowsFormatException("0.1")); |
| 226 Expect.equals(true, parseIntThrowsFormatException("0x3.1")); | 230 Expect.equals(true, parseIntThrowsFormatException("0x3.1")); |
| 227 Expect.equals(true, parseIntThrowsFormatException("5.")); | 231 Expect.equals(true, parseIntThrowsFormatException("5.")); |
| 228 Expect.equals(true, parseIntThrowsFormatException("+-5")); | 232 Expect.equals(true, parseIntThrowsFormatException("+-5")); |
| 229 Expect.equals(true, parseIntThrowsFormatException("-+5")); | 233 Expect.equals(true, parseIntThrowsFormatException("-+5")); |
| 230 Expect.equals(true, parseIntThrowsFormatException("--5")); | 234 Expect.equals(true, parseIntThrowsFormatException("--5")); |
| 231 Expect.equals(true, parseIntThrowsFormatException("++5")); | 235 Expect.equals(true, parseIntThrowsFormatException("++5")); |
| 232 Expect.equals(true, parseIntThrowsFormatException("+ 5")); | 236 Expect.equals(true, parseIntThrowsFormatException("+ 5")); |
| 233 Expect.equals(true, parseIntThrowsFormatException("- 5")); | 237 Expect.equals(true, parseIntThrowsFormatException("- 5")); |
| 234 Expect.equals(true, parseIntThrowsFormatException("")); | 238 Expect.equals(true, parseIntThrowsFormatException("")); |
| 235 Expect.equals(true, parseIntThrowsFormatException(" ")); | 239 Expect.equals(true, parseIntThrowsFormatException(" ")); |
| 236 Expect.equals(true, parseIntThrowsFormatException("+0x1234567890")); | |
| 237 Expect.equals(true, parseIntThrowsFormatException(" +0x1234567890 ")); | |
| 238 Expect.equals(true, parseIntThrowsFormatException("+0x100")); | |
| 239 Expect.equals(true, parseIntThrowsFormatException(" +0x100 ")); | |
| 240 } | 240 } |
| 241 | 241 |
| 242 static testMain() { | 242 static testMain() { |
| 243 testConstants(); | 243 testConstants(); |
| 244 testSin(); | 244 testSin(); |
| 245 testCos(); | 245 testCos(); |
| 246 testTan(); | 246 testTan(); |
| 247 testAsin(); | 247 testAsin(); |
| 248 testAcos(); | 248 testAcos(); |
| 249 testAtan(); | 249 testAtan(); |
| 250 testAtan2(); | 250 testAtan2(); |
| 251 testSqrt(); | 251 testSqrt(); |
| 252 testLog(); | 252 testLog(); |
| 253 testExp(); | 253 testExp(); |
| 254 testPow(); | 254 testPow(); |
| 255 testParseInt(); | 255 testParseInt(); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 main() { | 259 main() { |
| 260 MathTest.testMain(); | 260 MathTest.testMain(); |
| 261 } | 261 } |
| OLD | NEW |