Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: tests/language/arithmetic_test.dart

Issue 11098009: Implement SmiToInt and DoubleToInt. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698