39 lines
1.7 KiB
Python
39 lines
1.7 KiB
Python
from unittest import TestCase
|
|
from benchmark.common_divisor_count import cd_count
|
|
|
|
|
|
class Test_cd_count(TestCase):
|
|
# distances_true = {1: [0]}
|
|
# distances_false = {1: [1]}
|
|
def test_cd_count_1(self):
|
|
assert cd_count(a=0, b=15) == 2
|
|
|
|
# distances_true = {1: [393], 2: [0]}
|
|
# distances_false = {1: [0], 2: [1]}
|
|
def test_cd_count_2(self):
|
|
assert cd_count(a=393, b=0) == 2
|
|
|
|
# distances_true = {1: [10], 2: [25], 3: [0], 4: [0], 5: [0, 0, 1], 6: [0, 1], 7: [4]}
|
|
# distances_false = {1: [0], 2: [0], 3: [10], 4: [25], 5: [10, 5, 0], 6: [1, 0], 7: [0]}
|
|
def test_cd_count_3(self):
|
|
assert cd_count(a=-10, b=-25) == 2
|
|
|
|
# distances_true = {1: [402], 2: [6], 3: [403], 4: [0], 5: [0, 0, 1], 6: [0, 0], 7: [5, 1]}
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [6], 5: [402, 6, 0], 6: [1, 1], 7: [0, 0]}
|
|
def test_cd_count_4(self):
|
|
assert cd_count(a=402, b=-6) == 4
|
|
|
|
# distances_true = {1: [392], 2: [7], 3: [393], 4: [8], 5: [0, 0, 1], 6: [0, 1], 7: [6]}
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [392, 7, 0], 6: [1, 0], 7: [0]}
|
|
def test_cd_count_5(self):
|
|
assert cd_count(a=392, b=7) == 2
|
|
|
|
# distances_true = {1: [394], 2: [8], 3: [395], 4: [9], 5: [0, 0, 0, 1], 6: [0], 7: [1]}
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [394, 8, 2, 0], 6: [1], 7: [0]}
|
|
def test_cd_count_6(self):
|
|
assert cd_count(a=394, b=8) == 2
|
|
|
|
# distances_true = {1: [391], 2: [2], 3: [392], 4: [3], 5: [0, 0, 0, 1], 6: [0], 7: [0]}
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [391, 2, 1, 0], 6: [1], 7: [1]}
|
|
def test_cd_count_7(self):
|
|
assert cd_count(a=391, b=2) == 1
|