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

Unified Diff: tests/corelib/big_integer_arith_vm_test.dart

Issue 1211473002: Make int.gcd accept zero operands. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« runtime/lib/bigint.dart ('K') | « sdk/lib/core/int.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/big_integer_arith_vm_test.dart
diff --git a/tests/corelib/big_integer_arith_vm_test.dart b/tests/corelib/big_integer_arith_vm_test.dart
index 4c7f12de9406021e8d6f4f844ef286ac52afe0f0..ad0f8f71ba2dda72023ba6da322314de4bcdcf26 100644
--- a/tests/corelib/big_integer_arith_vm_test.dart
+++ b/tests/corelib/big_integer_arith_vm_test.dart
@@ -310,9 +310,33 @@ testBigintGcd() {
Expect.equals(21 <<40, x.gcd(m));
x = 0;
m = 1000000001;
- Expect.throws(() => x.gcd(m), (e) => e is ArgumentError);
+ Expect.equals(m, x.gcd(m));
x = 1000000001;
m = 0;
+ Expect.equals(x, x.gcd(m));
+ x = 0;
+ m = -1000000001;
+ Expect.equals(-m, x.gcd(m));
+ x = -1000000001;
+ m = 0;
+ Expect.equals(-x, x.gcd(m));
+ x = 0;
+ m = 0;
+ Expect.throws(() => x.gcd(m), (e) => e is ArgumentError);
+ x = 0;
+ m = 123456789012345678901234567890;
+ Expect.equals(m, x.gcd(m));
+ x = 123456789012345678901234567890;
+ m = 0;
+ Expect.equals(x, x.gcd(m));
+ x = 0;
+ m = -123456789012345678901234567890;
+ Expect.equals(-m, x.gcd(m));
+ x = -123456789012345678901234567890;
+ m = 0;
+ Expect.equals(-x, x.gcd(m));
+ x = 0;
+ m = 0;
Expect.throws(() => x.gcd(m), (e) => e is ArgumentError);
x = 1234567890;
m = 19;
« runtime/lib/bigint.dart ('K') | « sdk/lib/core/int.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698