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

Side by Side Diff: tests/language/src/ArithmeticTest.dart

Issue 8359022: allow rounding errors on a couple arithmetic tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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 | « no previous file | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class ArithmeticTest { 6 class ArithmeticTest {
7 7
8 static bool exceptionCaughtParseInt(String s) { 8 static bool exceptionCaughtParseInt(String s) {
9 try { 9 try {
10 Math.parseInt(s); 10 Math.parseInt(s);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 { double d = (1).toDouble(); } 315 { double d = (1).toDouble(); }
316 { double d = (-1).toDouble(); } 316 { double d = (-1).toDouble(); }
317 // Big. 317 // Big.
318 Expect.equals(big, big.toInt()); 318 Expect.equals(big, big.toInt());
319 Expect.equals(-big, (-big).toInt()); 319 Expect.equals(-big, (-big).toInt());
320 { int i = big.toInt(); } 320 { int i = big.toInt(); }
321 { int i = (-big).toInt(); } 321 { int i = (-big).toInt(); }
322 322
323 // Math functions. 323 // Math functions.
324 Expect.equals(2.0, Math.sqrt(4.0)); 324 Expect.equals(2.0, Math.sqrt(4.0));
325 Expect.equals(1.0, Math.sin(3.14159265 / 2.0)); 325 Expect.approxEquals(1.0, Math.sin(3.14159265 / 2.0));
326 Expect.equals(-1.0, Math.cos(3.14159265)); 326 Expect.approxEquals(-1.0, Math.cos(3.14159265));
327 327
328 Expect.equals(12, Math.parseInt("12")); 328 Expect.equals(12, Math.parseInt("12"));
329 Expect.equals(-12, Math.parseInt("-12")); 329 Expect.equals(-12, Math.parseInt("-12"));
330 Expect.equals(12345678901234567890, 330 Expect.equals(12345678901234567890,
331 Math.parseInt("12345678901234567890")); 331 Math.parseInt("12345678901234567890"));
332 Expect.equals(-12345678901234567890, 332 Expect.equals(-12345678901234567890,
333 Math.parseInt("-12345678901234567890")); 333 Math.parseInt("-12345678901234567890"));
334 // Type checks. 334 // Type checks.
335 { int i = Math.parseInt("12"); } 335 { int i = Math.parseInt("12"); }
336 { int i = Math.parseInt("-12"); } 336 { int i = Math.parseInt("-12"); }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 Expect.equals(false, (3.4).hashCode() == (1.2).hashCode()); 386 Expect.equals(false, (3.4).hashCode() == (1.2).hashCode());
387 Expect.equals(true, (1.2).hashCode() == (1.2).hashCode()); 387 Expect.equals(true, (1.2).hashCode() == (1.2).hashCode());
388 Expect.equals(false, (3).hashCode() == (1).hashCode()); 388 Expect.equals(false, (3).hashCode() == (1).hashCode());
389 Expect.equals(true, (10).hashCode() == (10).hashCode()); 389 Expect.equals(true, (10).hashCode() == (10).hashCode());
390 } 390 }
391 } 391 }
392 392
393 main() { 393 main() {
394 ArithmeticTest.testMain(); 394 ArithmeticTest.testMain();
395 } 395 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698