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
2023-12-18 15:13:31 +01:00

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: [7], 2: [561], 3: [8], 4: [0], 5: [0, 0, 1], 6: [0], 7: [0]}
# distances_false = {1: [0], 2: [0], 3: [0], 4: [561], 5: [7, 1, 0], 6: [1], 7: [1]}
def test_cd_count_1(self):
assert cd_count(a=7, b=-561) == 1
# distances_true = {1: [496], 2: [9], 3: [0], 4: [10], 5: [0, 0, 0, 1], 6: [0], 7: [0]}
# distances_false = {1: [0], 2: [0], 3: [496], 4: [0], 5: [496, 9, 1, 0], 6: [1], 7: [1]}
def test_cd_count_2(self):
assert cd_count(a=-496, b=9) == 1
# distances_true = {1: [1090], 2: [810], 3: [0], 4: [0], 5: [0, 0, 0, 0, 0, 0, 1], 6: [0, 0, 1], 7: [9, 3]}
# distances_false = {1: [0], 2: [0], 3: [1090], 4: [810], 5: [1090, 810, 280, 250, 30, 10, 0], 6: [1, 1, 0], 7: [0, 0]}
def test_cd_count_3(self):
assert cd_count(a=-1090, b=-810) == 4
# distances_true = {1: [771], 2: [0]}
# distances_false = {1: [0], 2: [1]}
def test_cd_count_4(self):
assert cd_count(a=771, b=0) == 2
# distances_true = {1: [0]}
# distances_false = {1: [1]}
def test_cd_count_5(self):
assert cd_count(a=0, b=-504) == 2
# distances_true = {1: [0]}
# distances_false = {1: [1]}
def test_cd_count_6(self):
assert cd_count(a=0, b=346) == 2