2023-12-24 13:55:34 +00:00
|
|
|
from unittest import TestCase
|
|
|
|
from benchmark.gcd import gcd
|
|
|
|
|
|
|
|
|
|
|
|
class Test_gcd(TestCase):
|
2023-12-27 15:07:31 +00:00
|
|
|
# distances_true = {1: [0]}
|
|
|
|
# distances_false = {1: [1]}
|
2023-12-24 13:55:34 +00:00
|
|
|
def test_gcd_1(self):
|
2023-12-27 15:07:31 +00:00
|
|
|
assert gcd(a=1, b=751) == 1
|
2023-12-24 13:55:34 +00:00
|
|
|
|
2023-12-27 15:07:31 +00:00
|
|
|
# distances_true = {1: [964], 2: [964], 3: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [1]}
|
2023-12-24 13:55:34 +00:00
|
|
|
def test_gcd_2(self):
|
2023-12-27 15:07:31 +00:00
|
|
|
assert gcd(a=965, b=965) == 965
|
|
|
|
|
|
|
|
# distances_true = {1: [700], 2: [440], 3: [260], 4: [261], 5: [0, 0, 0, 0, 0, 0, 0, 0, 1]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [441, 260, 181, 79, 23, 10, 3, 1, 0]}
|
|
|
|
def test_gcd_3(self):
|
|
|
|
assert gcd(a=701, b=441) == 1
|
|
|
|
|
|
|
|
# distances_true = {1: [941], 2: [944], 3: [3], 4: [0], 5: [0, 0, 1]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [3], 5: [942, 3, 0]}
|
|
|
|
def test_gcd_4(self):
|
|
|
|
assert gcd(a=942, b=945) == 3
|
|
|
|
|
|
|
|
# distances_true = {1: [354], 2: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [1]}
|
|
|
|
def test_gcd_5(self):
|
|
|
|
assert gcd(a=355, b=1) == 1
|