2023-12-09 19:52:07 +00:00
|
|
|
from unittest import TestCase
|
|
|
|
from benchmark.common_divisor_count import cd_count
|
|
|
|
|
|
|
|
|
|
|
|
class Test_cd_count(TestCase):
|
2023-12-21 22:54:39 +00:00
|
|
|
# distances_true = {1: [5], 2: [618], 3: [6], 4: [619], 5: [0, 0, 0, 0, 1], 6: [0], 7: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [0], 5: [5, 3, 2, 1, 0], 6: [1], 7: [1]}
|
2023-12-09 19:52:07 +00:00
|
|
|
def test_cd_count_1(self):
|
2023-12-21 22:54:39 +00:00
|
|
|
assert cd_count(a=5, b=618) == 1
|
2023-12-09 19:52:07 +00:00
|
|
|
|
2023-12-21 22:54:39 +00:00
|
|
|
# distances_true = {1: [0]}
|
|
|
|
# distances_false = {1: [1]}
|
2023-12-09 19:52:07 +00:00
|
|
|
def test_cd_count_2(self):
|
2023-12-21 22:54:39 +00:00
|
|
|
assert cd_count(a=0, b=-49) == 2
|
2023-12-09 19:52:07 +00:00
|
|
|
|
2023-12-21 22:54:39 +00:00
|
|
|
# distances_true = {1: [4], 2: [101], 3: [5], 4: [0], 5: [0, 0, 1], 6: [0], 7: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [0], 4: [101], 5: [4, 1, 0], 6: [1], 7: [1]}
|
2023-12-09 19:52:07 +00:00
|
|
|
def test_cd_count_3(self):
|
2023-12-21 22:54:39 +00:00
|
|
|
assert cd_count(a=4, b=-101) == 1
|
2023-12-09 19:52:07 +00:00
|
|
|
|
2023-12-21 22:54:39 +00:00
|
|
|
# distances_true = {1: [10], 2: [52], 3: [0], 4: [0], 5: [0, 0, 1], 6: [0], 7: [1]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [10], 4: [52], 5: [10, 2, 0], 6: [1], 7: [0]}
|
2023-12-09 19:52:07 +00:00
|
|
|
def test_cd_count_4(self):
|
2023-12-21 22:54:39 +00:00
|
|
|
assert cd_count(a=-10, b=-52) == 2
|
2023-12-09 19:52:07 +00:00
|
|
|
|
2023-12-21 22:54:39 +00:00
|
|
|
# distances_true = {1: [9], 2: [0]}
|
|
|
|
# distances_false = {1: [0], 2: [1]}
|
2023-12-09 19:52:07 +00:00
|
|
|
def test_cd_count_5(self):
|
2023-12-21 22:54:39 +00:00
|
|
|
assert cd_count(a=9, b=0) == 2
|
2023-12-18 14:13:31 +00:00
|
|
|
|
2023-12-21 22:54:39 +00:00
|
|
|
# distances_true = {1: [10], 2: [150], 3: [0], 4: [0], 5: [0, 1], 6: [0, 0, 1], 7: [9, 3]}
|
|
|
|
# distances_false = {1: [0], 2: [0], 3: [10], 4: [150], 5: [10, 0], 6: [1, 1, 0], 7: [0, 0]}
|
2023-12-18 14:13:31 +00:00
|
|
|
def test_cd_count_6(self):
|
2023-12-21 22:54:39 +00:00
|
|
|
assert cd_count(a=-10, b=-150) == 4
|