34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
from unittest import TestCase
|
|
from benchmark.common_divisor_count import cd_count
|
|
|
|
|
|
class Test_cd_count(TestCase):
|
|
# distances_true = {1: [301], 2: [0]}
|
|
# distances_false = {1: [0], 2: [1]}
|
|
def test_cd_count_1(self):
|
|
assert cd_count(a=301, b=0) == 2
|
|
|
|
# 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]}
|
|
def test_cd_count_2(self):
|
|
assert cd_count(a=28, b=7) == 2
|
|
|
|
# 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]}
|
|
def test_cd_count_3(self):
|
|
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
|