34 lines
1.4 KiB
Python
34 lines
1.4 KiB
Python
from unittest import TestCase
|
|
from benchmark.common_divisor_count import cd_count
|
|
|
|
|
|
class Test_cd_count(TestCase):
|
|
# distances_true = {1: [5], 2: [621], 3: [0], 4: [622], 5: [0, 0, 1], 6: [0], 7: [0]}
|
|
# distances_false = {1: [0], 2: [0], 3: [5], 4: [0], 5: [5, 1, 0], 6: [1], 7: [1]}
|
|
def test_cd_count_1(self):
|
|
assert cd_count(a=-5, b=621) == 1
|
|
|
|
# distances_true = {1: [0]}
|
|
# distances_false = {1: [1]}
|
|
def test_cd_count_2(self):
|
|
assert cd_count(a=0, b=621) == 2
|
|
|
|
# distances_true = {1: [2], 2: [616], 3: [3], 4: [617], 5: [0, 1], 6: [0], 7: [1]}
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [2, 0], 6: [1], 7: [0]}
|
|
def test_cd_count_3(self):
|
|
assert cd_count(a=2, b=616) == 2
|
|
|
|
# distances_true = {1: [7], 2: [630], 3: [0], 4: [631], 5: [0, 1], 6: [0, 1], 7: [6]}
|
|
# distances_false = {1: [0], 2: [0], 3: [7], 4: [0], 5: [7, 0], 6: [1, 0], 7: [0]}
|
|
def test_cd_count_4(self):
|
|
assert cd_count(a=-7, b=630) == 2
|
|
|
|
# distances_true = {1: [624], 2: [0]}
|
|
# distances_false = {1: [0], 2: [1]}
|
|
def test_cd_count_5(self):
|
|
assert cd_count(a=-624, b=0) == 2
|
|
|
|
# distances_true = {1: [637], 2: [6], 3: [0], 4: [0], 5: [0, 0, 0, 1], 6: [0], 7: [0]}
|
|
# distances_false = {1: [0], 2: [0], 3: [637], 4: [6], 5: [637, 6, 1, 0], 6: [1], 7: [1]}
|
|
def test_cd_count_6(self):
|
|
assert cd_count(a=-637, b=-6) == 1
|