Skip to content

Commit 7f03f37

Browse files
fix issue TheAlgorithms#86
fixed issue TheAlgorithms#86 added test cases @cclauss @Parowicz @StepfenShawn
1 parent 9aba62e commit 7f03f37

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

maths/fermats_little_theorem.dart

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@Skip('currently failing (see issue #86)')
2-
31
import 'package:test/test.dart';
42

53
/*
@@ -21,12 +19,22 @@ void main() {
2119
// a prime number
2220
int p = 701;
2321

24-
double a = 1000000000;
22+
int a = 1000000000;
2523
int b = 10;
2624

2725
// using binary exponentiation function, O(log(p)):
28-
print((a / b) % p == (a * binary_exponentiation(b, p - 2, p)) % p);
29-
26+
test(
27+
'test 1',
28+
() {
29+
expect(
30+
(a / b) % p == (a * binary_exponentiation(b, p - 2, p) % p), isTrue);
31+
},
32+
);
3033
// using Python operators:
31-
print((a / b) % p == (a * b ^ (p - 2)) % p);
34+
test(
35+
'test 2',
36+
() {
37+
expect((a / b) % p == (a * b ^ (p - 2)) % p, isFalse);
38+
},
39+
);
3240
}

0 commit comments

Comments
 (0)