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

Side by Side Diff: tests/corelib/big_integer_arith_vm_test.dart

Issue 1198993003: - Split big integer tests into pieces. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: updated to ToT Created 5 years, 6 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
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | 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 4
5 // Testing Bigints with and without intrinsics. 5 // Testing Bigints with and without intrinsics.
6 // VMOptions= 6 // VMOptions=
7 // VMOptions=--no_intrinsify 7 // VMOptions=--no_intrinsify
8 // VMOptions=--optimization_counter_threshold=10
8 9
9 library big_integer_test; 10 library big_integer_test;
10 import "package:expect/expect.dart"; 11 import "package:expect/expect.dart";
11 12
12 foo() => 1234567890123456789; 13 foo() => 1234567890123456789;
13 bar() => 12345678901234567890; 14 bar() => 12345678901234567890;
14 15
15 testSmiOverflow() { 16 testSmiOverflow() {
16 var a = 1073741823; 17 var a = 1073741823;
17 var b = 1073741822; 18 var b = 1073741822;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 bool exceptionCaught = false; 390 bool exceptionCaught = false;
390 try { 391 try {
391 var a = 1 << 1111111111111111111111111111; 392 var a = 1 << 1111111111111111111111111111;
392 } on OutOfMemoryError catch (e) { 393 } on OutOfMemoryError catch (e) {
393 exceptionCaught = true; 394 exceptionCaught = true;
394 } 395 }
395 Expect.equals(true, exceptionCaught); 396 Expect.equals(true, exceptionCaught);
396 } 397 }
397 398
398 main() { 399 main() {
399 Expect.equals(1234567890123456789, foo()); 400 for (int i = 0; i < 10; i++) {
400 Expect.equals(12345678901234567890, bar()); 401 Expect.equals(1234567890123456789, foo());
401 testSmiOverflow(); 402 Expect.equals(12345678901234567890, bar());
402 testBigintAdd(); 403 testSmiOverflow(); /// overflow: ok
403 testBigintSub(); 404 testBigintAdd(); /// add: ok
404 testBigintMul(); 405 testBigintSub(); /// sub: ok
405 testBigintTruncDiv(); 406 testBigintMul(); /// mul: ok
406 testBigintDiv(); 407 testBigintTruncDiv(); /// trunDiv: ok
407 testBigintModulo(); 408 testBigintDiv(); /// div: ok
408 testBigintModPow(); 409 testBigintModulo(); /// mod: ok
409 testBigintModInverse(); 410 testBigintModPow(); /// modPow: ok
410 testBigintGcd(); 411 testBigintModInverse(); /// modInv: ok
411 testBigintNegate(); 412 testBigintGcd(); /// gcd: ok
412 testShiftAmount(); 413 testBigintNegate(); /// negate: ok
413 Expect.equals(12345678901234567890, (12345678901234567890).abs()); 414 testShiftAmount(); /// shift: ok
414 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); 415 Expect.equals(12345678901234567890, (12345678901234567890).abs());
415 var a = 10000000000000000000; 416 Expect.equals(12345678901234567890, (-12345678901234567890).abs());
416 var b = 10000000000000000001; 417 var a = 10000000000000000000;
417 Expect.equals(false, a.hashCode == b.hashCode); 418 var b = 10000000000000000001;
418 Expect.equals(true, a.hashCode == (b - 1).hashCode); 419 Expect.equals(false, a.hashCode == b.hashCode);
420 Expect.equals(true, a.hashCode == (b - 1).hashCode);
421 }
419 } 422 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698