| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Dart test program to test arithmetic operations. | 4 // Dart test program to test arithmetic operations. |
| 5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr |
| 5 | 6 |
| 6 library arithmetic_test; | 7 library arithmetic_test; |
| 7 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 8 import 'dart:math'; | 9 import 'dart:math'; |
| 9 | 10 |
| 10 class ArithmeticTest { | 11 class ArithmeticTest { |
| 11 | 12 |
| 12 static bool exceptionCaughtParseInt(String s) { | 13 static bool exceptionCaughtParseInt(String s) { |
| 13 try { | 14 try { |
| 14 int.parse(s); | 15 int.parse(s); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 Expect.equals(2.0, mySqrt(4.0)); | 435 Expect.equals(2.0, mySqrt(4.0)); |
| 435 Expect.throws(() => mySqrt("abc")); | 436 Expect.throws(() => mySqrt("abc")); |
| 436 } | 437 } |
| 437 | 438 |
| 438 static self_equality(x) { | 439 static self_equality(x) { |
| 439 return x == x; | 440 return x == x; |
| 440 } | 441 } |
| 441 | 442 |
| 442 static testDoubleEquality() { | 443 static testDoubleEquality() { |
| 443 Expect.isFalse(self_equality(double.NAN)); | 444 Expect.isFalse(self_equality(double.NAN)); |
| 444 for (int i = 0; i < 2000; i++) { | 445 for (int i = 0; i < 20; i++) { |
| 445 self_equality(3.0); | 446 self_equality(3.0); |
| 446 } | 447 } |
| 447 Expect.isFalse(self_equality(double.NAN)); | 448 Expect.isFalse(self_equality(double.NAN)); |
| 448 } | 449 } |
| 449 | 450 |
| 450 static testMain() { | 451 static testMain() { |
| 451 for (int i = 0; i < 1500; i++) { | 452 for (int i = 0; i < 20; i++) { |
| 452 runOne(); | 453 runOne(); |
| 453 testSmiDivDeopt(); | 454 testSmiDivDeopt(); |
| 454 testSqrtDeopt(); | 455 testSqrtDeopt(); |
| 455 testDoubleEquality(); | 456 testDoubleEquality(); |
| 456 } | 457 } |
| 457 } | 458 } |
| 458 } | 459 } |
| 459 | 460 |
| 460 main() { | 461 main() { |
| 461 ArithmeticTest.testMain(); | 462 ArithmeticTest.testMain(); |
| 462 } | 463 } |
| OLD | NEW |