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

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

Issue 11573044: Inline Doubles truncate and round. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 Expect.equals(-3.0, (-2.6).round()); 275 Expect.equals(-3.0, (-2.6).round());
276 Expect.equals(0.0, (0.0).round()); 276 Expect.equals(0.0, (0.0).round());
277 Expect.equals(0.0, (0.1).round()); 277 Expect.equals(0.0, (0.1).round());
278 Expect.equals(false, (0.0).round().isNegative); 278 Expect.equals(false, (0.0).round().isNegative);
279 Expect.equals(false, (0.1).round().isNegative); 279 Expect.equals(false, (0.1).round().isNegative);
280 Expect.equals(-0.0, (-0.0).round()); 280 Expect.equals(-0.0, (-0.0).round());
281 Expect.equals(-0.0, (-0.3).round()); 281 Expect.equals(-0.0, (-0.3).round());
282 Expect.equals(2.0, (2.1).round()); 282 Expect.equals(2.0, (2.1).round());
283 Expect.equals(-2.0, (-2.1).round()); 283 Expect.equals(-2.0, (-2.1).round());
284 Expect.equals(1.0, (0.5).round()); 284 Expect.equals(1.0, (0.5).round());
285 // TODO(floitsch): enable or adapt test, once we reached conclusion on 285 Expect.equals(0.0, (0.49999999999999994).round());
286 // b/4539188. 286 Expect.equals(-0.0, (-0.49999999999999994).round());
287 // Expect.equals(-0.0, (-0.5).round()); 287 Expect.equals(-1.0, (-0.5).round());
288 // TODO(srdjan): enable the following tests once isNegative works. 288 Expect.equals(true, (-0.0).round().isNegative);
289 // Expect.equals(true, (-0.0).round().isNegative); 289 Expect.equals(true, (-0.3).round().isNegative);
290 // Expect.equals(true, (-0.3).round().isNegative); 290 Expect.equals(true, (-0.5).round().isNegative);
291 // Expect.equals(true, (-0.5).round().isNegative);
292 Expect.equals(2.0, (1.5).round()); 291 Expect.equals(2.0, (1.5).round());
293 // TODO(floitsch): enable or adapt test, once we reached conclusion on 292 Expect.equals(-2.0, (-1.5).round());
294 // b/4539188.
295 // Expect.equals(-1.0, (-1.5).round());
296 Expect.equals(1.0, (0.99).round()); 293 Expect.equals(1.0, (0.99).round());
294 Expect.equals(9007199254740991.0, (9007199254740991.0).round());
295 Expect.equals(-9007199254740991.0, (-9007199254740991.0).round());
297 296
298 // -- toInt --. 297 // -- toInt --.
299 // Smi. 298 // Smi.
300 Expect.equals(0, (0).toInt()); 299 Expect.equals(0, (0).toInt());
301 Expect.equals(1, (1).toInt()); 300 Expect.equals(1, (1).toInt());
302 Expect.equals(-1, (-1).toInt()); 301 Expect.equals(-1, (-1).toInt());
303 // Type checks. 302 // Type checks.
304 { int i = (0).toInt(); } 303 { int i = (0).toInt(); }
305 { int i = (1).toInt(); } 304 { int i = (1).toInt(); }
306 { int i = (-1).toInt(); } 305 { int i = (-1).toInt(); }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 for (int i = 0; i < 1500; i++) { 423 for (int i = 0; i < 1500; i++) {
425 runOne(); 424 runOne();
426 testSmiDivDeopt(); 425 testSmiDivDeopt();
427 } 426 }
428 } 427 }
429 } 428 }
430 429
431 main() { 430 main() {
432 ArithmeticTest.testMain(); 431 ArithmeticTest.testMain();
433 } 432 }
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