This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
kse-02/tests/test_common_divisor_count.py

35 lines
1.4 KiB
Python
Raw Normal View History

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-27 15:07:31 +00:00
# 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]}
2023-12-25 21:24:01 +00:00
def test_cd_count_1(self):
2023-12-27 15:07:31 +00:00
assert cd_count(a=-5, b=621) == 1
2023-12-25 21:24:01 +00:00
2023-12-27 15:07:31 +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-27 15:07:31 +00:00
assert cd_count(a=0, b=621) == 2
2023-12-09 19:52:07 +00:00
2023-12-27 15:07:31 +00:00
# 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]}
2023-12-09 19:52:07 +00:00
def test_cd_count_3(self):
2023-12-27 15:07:31 +00:00
assert cd_count(a=2, b=616) == 2
2023-12-09 19:52:07 +00:00
2023-12-27 15:07:31 +00:00
# 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]}
2023-12-09 19:52:07 +00:00
def test_cd_count_4(self):
2023-12-27 15:07:31 +00:00
assert cd_count(a=-7, b=630) == 2
2023-12-09 19:52:07 +00:00
2023-12-27 15:07:31 +00:00
# distances_true = {1: [624], 2: [0]}
# distances_false = {1: [0], 2: [1]}
2023-12-09 19:52:07 +00:00
def test_cd_count_5(self):
2023-12-27 15:07:31 +00:00
assert cd_count(a=-624, b=0) == 2
2023-12-18 14:13:31 +00:00
2023-12-27 15:07:31 +00:00
# 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]}
2023-12-18 14:13:31 +00:00
def test_cd_count_6(self):
2023-12-27 15:07:31 +00:00
assert cd_count(a=-637, b=-6) == 1