| 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('dart:math'); | 7 #import('dart:math'); |
| 8 | 8 |
| 9 class ArithmeticTest { | 9 class ArithmeticTest { |
| 10 | 10 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // Double. | 312 // Double. |
| 313 Expect.equals(1234567890123, (1234567890123.0).toInt()); | 313 Expect.equals(1234567890123, (1234567890123.0).toInt()); |
| 314 Expect.equals(-1234567890123, (-1234567890123.0).toInt()); | 314 Expect.equals(-1234567890123, (-1234567890123.0).toInt()); |
| 315 { int i = (1234567890123.0).toInt(); } | 315 { int i = (1234567890123.0).toInt(); } |
| 316 { int i = (-1234567890123.0).toInt(); } | 316 { int i = (-1234567890123.0).toInt(); } |
| 317 // 32bit Smi border cases. | 317 // 32bit Smi border cases. |
| 318 Expect.equals(-1073741824, (-1073741824.0).toInt()); | 318 Expect.equals(-1073741824, (-1073741824.0).toInt()); |
| 319 Expect.equals(-1073741825, (-1073741825.0).toInt()); | 319 Expect.equals(-1073741825, (-1073741825.0).toInt()); |
| 320 Expect.equals(1073741823, (1073741823.0).toInt()); | 320 Expect.equals(1073741823, (1073741823.0).toInt()); |
| 321 Expect.equals(1073741824, (1073741824.0).toInt()); | 321 Expect.equals(1073741824, (1073741824.0).toInt()); |
| 322 |
| 322 { int i = (-1073741824.0).toInt(); } | 323 { int i = (-1073741824.0).toInt(); } |
| 323 { int i = (-1073741825.0).toInt(); } | 324 { int i = (-1073741825.0).toInt(); } |
| 324 { int i = (1073741823.0).toInt(); } | 325 { int i = (1073741823.0).toInt(); } |
| 325 { int i = (1073741824.0).toInt(); } | 326 { int i = (1073741824.0).toInt(); } |
| 326 | 327 |
| 327 // -- toDouble --. | 328 // -- toDouble --. |
| 328 // Smi. | 329 // Smi. |
| 329 Expect.equals(0.0, (0).toDouble()); | 330 Expect.equals(0.0, (0).toDouble()); |
| 330 Expect.equals(1.0, (1).toDouble()); | 331 Expect.equals(1.0, (1).toDouble()); |
| 331 Expect.equals(-1.0, (-1).toDouble()); | 332 Expect.equals(-1.0, (-1).toDouble()); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 static testMain() { | 415 static testMain() { |
| 415 for (int i = 0; i < 1500; i++) { | 416 for (int i = 0; i < 1500; i++) { |
| 416 runOne(); | 417 runOne(); |
| 417 } | 418 } |
| 418 } | 419 } |
| 419 } | 420 } |
| 420 | 421 |
| 421 main() { | 422 main() { |
| 422 ArithmeticTest.testMain(); | 423 ArithmeticTest.testMain(); |
| 423 } | 424 } |
| OLD | NEW |