We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d2be00 commit 7878fc0Copy full SHA for 7878fc0
algorithms/math/__init__.py
algorithms/tests/test_math.py
@@ -0,0 +1,25 @@
1
+import unittest
2
+from ..math.extended_gcd import extended_gcd
3
+
4
+class TestExtendedGCD(unittest.TestCase):
5
6
+ def test_extended_gcd(self):
7
+ # Find extended_gcd of 35 and 77
8
+ (a,b) = extended_gcd(35, 77)
9
+ self.assertIs(35*a + 77*b, 7)
10
11
+ # Find extended_gcd of 15 and 19
12
+ (a,b) = extended_gcd(15, 19)
13
+ self.assertIs(15*a + 19*b, 1)
14
15
+ # Find extended_gcd of 18 and 9
16
+ (a,b) = extended_gcd(18, 9)
17
+ self.assertIs(18*a + 9*b, 9)
18
19
+ # Find extended_gcd of 99 and 81
20
+ (a,b) = extended_gcd(99, 81)
21
+ self.assertIs(99*a + 81*b, 9)
22
23
+ # Find extended_gcd of 50 and 15
24
+ (a,b) = extended_gcd(50, 15)
25
+ self.assertIs(50*a + 15*b, 5)
0 commit comments