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

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: Address comment. Created 5 years, 5 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
« no previous file with comments | « sdk/lib/core/int.dart ('k') | tests/corelib/int_modulo_arith_test.dart » ('j') | 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 03246ba34325ca9b3eff900a3ad774158a4381a7..0d2f5169d92716b41127a62c6312869b99dadc5c 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;
« no previous file with comments | « sdk/lib/core/int.dart ('k') | tests/corelib/int_modulo_arith_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698