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 7492d0834e340abea24fb073537de10fce7e43e2..3353756335d7e0ba3cc1354d32d8f5c6ea96b742 100644 |
--- a/tests/corelib/big_integer_arith_vm_test.dart |
+++ b/tests/corelib/big_integer_arith_vm_test.dart |
@@ -223,21 +223,14 @@ testBigintModPow() { |
Expect.equals(40128068573873018143207285483, x.modPow(e, m)); |
} |
-// TODO(regis): Remove once even modulus is implemented. |
-UnimplementedEvenModulusModInverse(x, m) { |
- Expect.equals(true, m.isEven); |
- try { |
- x.modInverse(m); |
- Expect.fail("Did not throw UnimplementedError"); |
- } on UnimplementedError catch (e) { |
- } |
-} |
- |
testBigintModInverse() { |
var x, m; |
+ x = 1; |
+ m = 1; |
+ Expect.equals(0, x.modInverse(m)); |
x = 0; |
m = 1000000001; |
- Expect.equals(0, x.modInverse(m)); // Not coprime. |
+ Expect.throws(() => x.modInverse(m), (e) => e is RangeError); // Not coprime. |
x = 1234567890; |
m = 19; |
Expect.equals(11, x.modInverse(m)); |
@@ -246,7 +239,7 @@ testBigintModInverse() { |
Expect.equals(189108911, x.modInverse(m)); |
x = 19; |
m = 1000000001; |
- Expect.equals(0, x.modInverse(m)); // Not coprime. |
+ Expect.throws(() => x.modInverse(m), (e) => e is RangeError); // Not coprime. |
x = 19; |
m = 1234567890; |
Expect.equals(519818059, x.modInverse(m)); |
@@ -255,7 +248,7 @@ testBigintModInverse() { |
Expect.equals(1001100101, x.modInverse(m)); |
x = 1000000001; |
m = 19; |
- Expect.equals(0, x.modInverse(m)); // Not coprime. |
+ Expect.throws(() => x.modInverse(m), (e) => e is RangeError); // Not coprime. |
x = 12345678901234567890; |
m = 19; |
Expect.equals(3, x.modInverse(m)); |
@@ -267,10 +260,10 @@ testBigintModInverse() { |
Expect.equals(6315789473684210527, x.modInverse(m)); |
x = 19; |
m = 12345678901234567890; |
- UnimplementedEvenModulusModInverse(x, m); |
+ Expect.equals(10396361179987004539, x.modInverse(m)); |
x = 10000000000000000001; |
m = 12345678901234567890; |
- UnimplementedEvenModulusModInverse(x, m); |
+ Expect.equals(325004555487045911, x.modInverse(m)); |
x = 10000000000000000001; |
m = 19; |
Expect.equals(7, x.modInverse(m)); |
@@ -282,7 +275,7 @@ testBigintModInverse() { |
Expect.equals(3, x.modInverse(m)); |
x = 123456789012345678901234567890; |
m = 123456789012345678901234567899; |
- Expect.equals(0, x.modInverse(m)); // Not coprime. |
+ Expect.throws(() => x.modInverse(m), (e) => e is RangeError); // Not coprime. |
x = 123456789012345678901234567890; |
m = 123456789012345678901234567891; |
Expect.equals(123456789012345678901234567890, x.modInverse(m)); |
@@ -291,10 +284,10 @@ testBigintModInverse() { |
Expect.equals(77160493132716049313271604932, x.modInverse(m)); |
x = 123456789012345678901234567899; |
m = 123456789012345678901234567890; |
- UnimplementedEvenModulusModInverse(x, m); |
+ Expect.throws(() => x.modInverse(m), (e) => e is RangeError); // Not coprime. |
x = 123456789012345678901234567891; |
m = 123456789012345678901234567890; |
- UnimplementedEvenModulusModInverse(x, m); |
+ Expect.equals(1, x.modInverse(m)); |
x = 123456789012345678901234567891; |
m = 123456789012345678901234567899; |
Expect.equals(46296295879629629587962962962, x.modInverse(m)); |