2023-12-24 13:55:34 +00:00
|
|
|
from unittest import TestCase
|
|
|
|
from benchmark.common_divisor_count import cd_count
|
|
|
|
|
|
|
|
|
|
|
|
class Test_cd_count(TestCase):
|
2023-12-27 15:07:31 +00:00
|
|
|
# distances_true = {1: [301], 2: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [1]}
|
2023-12-24 13:55:34 +00:00
|
|
|
def test_cd_count_1(self):
|
2023-12-27 15:07:31 +00:00
|
|
|
assert cd_count(a=301, b=0) == 2
|
2023-12-24 13:55:34 +00:00
|
|
|
|
2023-12-27 15:07:31 +00:00
|
|
|
# distances_true = {1: [28], 2: [7], 3: [29], 4: [8], 5: [0, 0, 1], 6: [0, 1], 7: [6]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [28, 7, 0], 6: [1, 0], 7: [0]}
|
2023-12-24 13:55:34 +00:00
|
|
|
def test_cd_count_2(self):
|
2023-12-27 15:07:31 +00:00
|
|
|
assert cd_count(a=28, b=7) == 2
|
2023-12-24 13:55:34 +00:00
|
|
|
|
2023-12-27 15:07:31 +00:00
|
|
|
# distances_true = {1: [153], 2: [2], 3: [154], 4: [3], 5: [0, 0, 0, 1], 6: [0], 7: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [153, 2, 1, 0], 6: [1], 7: [1]}
|
2023-12-24 13:55:34 +00:00
|
|
|
def test_cd_count_3(self):
|
2023-12-27 15:07:31 +00:00
|
|
|
assert cd_count(a=153, b=2) == 1
|
|
|
|
|
|
|
|
# distances_true = {1: [502], 2: [178], 3: [503], 4: [179], 5: [0, 0, 0, 0, 0, 0, 0, 0, 1], 6: [0], 7: [1]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [502, 178, 146, 32, 18, 14, 4, 2, 0], 6: [1], 7: [0]}
|
|
|
|
def test_cd_count_4(self):
|
|
|
|
assert cd_count(a=502, b=178) == 2
|
|
|
|
|
|
|
|
# distances_true = {1: [0]}
|
|
|
|
# distances_false = {1: [1]}
|
|
|
|
def test_cd_count_5(self):
|
|
|
|
assert cd_count(a=0, b=904) == 2
|
|
|
|
|
|
|
|
# distances_true = {1: [443], 2: [6], 3: [0], 4: [0], 5: [0, 0, 0, 0, 1], 6: [0], 7: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [443], 4: [6], 5: [443, 6, 5, 1, 0], 6: [1], 7: [1]}
|
|
|
|
def test_cd_count_6(self):
|
|
|
|
assert cd_count(a=-443, b=-6) == 1
|