| 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 | 5 |
| 6 library arithmetic_test; | 6 library arithmetic_test; |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:math'; | 8 import 'dart:math'; |
| 9 | 9 |
| 10 class ArithmeticTest { | 10 class ArithmeticTest { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 428 } |
| 429 | 429 |
| 430 static mySqrt(var x) => sqrt(x); | 430 static mySqrt(var x) => sqrt(x); |
| 431 | 431 |
| 432 static testSqrtDeopt() { | 432 static testSqrtDeopt() { |
| 433 for (var i = 0; i < 10; i++) mySqrt(4.0); | 433 for (var i = 0; i < 10; i++) mySqrt(4.0); |
| 434 Expect.equals(2.0, mySqrt(4.0)); | 434 Expect.equals(2.0, mySqrt(4.0)); |
| 435 Expect.throws(() => mySqrt("abc")); | 435 Expect.throws(() => mySqrt("abc")); |
| 436 } | 436 } |
| 437 | 437 |
| 438 static self_equality(x) { |
| 439 return x == x; |
| 440 } |
| 441 |
| 442 static testDoubleEquality() { |
| 443 Expect.isFalse(self_equality(double.NAN)); |
| 444 for (int i = 0; i < 2000; i++) { |
| 445 self_equality(3.0); |
| 446 } |
| 447 Expect.isFalse(self_equality(double.NAN)); |
| 448 } |
| 449 |
| 438 static testMain() { | 450 static testMain() { |
| 439 for (int i = 0; i < 1500; i++) { | 451 for (int i = 0; i < 1500; i++) { |
| 440 runOne(); | 452 runOne(); |
| 441 testSmiDivDeopt(); | 453 testSmiDivDeopt(); |
| 442 testSqrtDeopt(); | 454 testSqrtDeopt(); |
| 455 testDoubleEquality(); |
| 443 } | 456 } |
| 444 } | 457 } |
| 445 } | 458 } |
| 446 | 459 |
| 447 main() { | 460 main() { |
| 448 ArithmeticTest.testMain(); | 461 ArithmeticTest.testMain(); |
| 449 } | 462 } |
| OLD | NEW |