| 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 // VMOptions=--optimization-counter-threshold=10 --no-use-osr |
| 6 | 6 |
| 7 library arithmetic_test; | 7 library arithmetic_test; |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 import 'dart:math'; | 9 import 'dart:math'; |
| 10 | 10 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 Expect.equals(0, (0.1).round()); | 284 Expect.equals(0, (0.1).round()); |
| 285 Expect.equals(3, (2.5).round()); | 285 Expect.equals(3, (2.5).round()); |
| 286 Expect.equals(-3, (-2.5).round()); | 286 Expect.equals(-3, (-2.5).round()); |
| 287 Expect.isFalse((0.0).round().isNegative); | 287 Expect.isFalse((0.0).round().isNegative); |
| 288 Expect.isFalse((0.1).round().isNegative); | 288 Expect.isFalse((0.1).round().isNegative); |
| 289 Expect.equals(0, (-0.0).round()); | 289 Expect.equals(0, (-0.0).round()); |
| 290 Expect.equals(0, (-0.3).round()); | 290 Expect.equals(0, (-0.3).round()); |
| 291 Expect.equals(2, (2.1).round()); | 291 Expect.equals(2, (2.1).round()); |
| 292 Expect.equals(-2, (-2.1).round()); | 292 Expect.equals(-2, (-2.1).round()); |
| 293 Expect.equals(1, (0.5).round()); | 293 Expect.equals(1, (0.5).round()); |
| 294 Expect.equals(0, (0.49999999999999994).round()); | |
| 295 Expect.equals(0, (-0.49999999999999994).round()); | |
| 296 Expect.equals(-1, (-0.5).round()); | 294 Expect.equals(-1, (-0.5).round()); |
| 297 Expect.isTrue((-0.0).round() is int); | 295 Expect.isTrue((-0.0).round() is int); |
| 298 Expect.isTrue((-0.3).round() is int); | 296 Expect.isTrue((-0.3).round() is int); |
| 299 Expect.isTrue((-0.5).round() is int); | 297 Expect.isTrue((-0.5).round() is int); |
| 300 Expect.equals(2, (1.5).round()); | 298 Expect.equals(2, (1.5).round()); |
| 301 Expect.equals(-2, (-1.5).round()); | 299 Expect.equals(-2, (-1.5).round()); |
| 302 Expect.equals(1, (0.99).round()); | 300 Expect.equals(1, (0.99).round()); |
| 303 Expect.equals(9007199254740991, (9007199254740991.0).round()); | |
| 304 Expect.equals(-9007199254740991, (-9007199254740991.0).round()); | |
| 305 | 301 |
| 306 // -- toInt --. | 302 // -- toInt --. |
| 307 // Smi. | 303 // Smi. |
| 308 Expect.equals(0, (0).toInt()); | 304 Expect.equals(0, (0).toInt()); |
| 309 Expect.equals(1, (1).toInt()); | 305 Expect.equals(1, (1).toInt()); |
| 310 Expect.equals(-1, (-1).toInt()); | 306 Expect.equals(-1, (-1).toInt()); |
| 311 // Type checks. | 307 // Type checks. |
| 312 { int i = (0).toInt(); } | 308 { int i = (0).toInt(); } |
| 313 { int i = (1).toInt(); } | 309 { int i = (1).toInt(); } |
| 314 { int i = (-1).toInt(); } | 310 { int i = (-1).toInt(); } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 testSmiDivDeopt(); | 450 testSmiDivDeopt(); |
| 455 testSqrtDeopt(); | 451 testSqrtDeopt(); |
| 456 testDoubleEquality(); | 452 testDoubleEquality(); |
| 457 } | 453 } |
| 458 } | 454 } |
| 459 } | 455 } |
| 460 | 456 |
| 461 main() { | 457 main() { |
| 462 ArithmeticTest.testMain(); | 458 ArithmeticTest.testMain(); |
| 463 } | 459 } |
| OLD | NEW |