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_rabin_karp.py

20 lines
749 B
Python
Raw Normal View History

2023-12-09 19:52:07 +00:00
from unittest import TestCase
from benchmark.rabin_karp import rabin_karp_search
class Test_rabin_karp_search(TestCase):
2023-12-27 15:07:31 +00:00
# distances_true = {1: [0], 2: [1, 0], 3: [1], 4: [1]}
# distances_false = {1: [1], 2: [0, 4], 3: [0], 4: [0]}
2023-12-09 19:52:07 +00:00
def test_rabin_karp_search_1(self):
2023-12-27 15:07:31 +00:00
assert rabin_karp_search(pat='A@@', txt='A<g') == []
2023-12-09 19:52:07 +00:00
2023-12-27 15:07:31 +00:00
# distances_true = {1: [28], 4: [1]}
2023-12-25 21:24:01 +00:00
# distances_false = {1: [0], 4: [0]}
2023-12-09 19:52:07 +00:00
def test_rabin_karp_search_2(self):
2023-12-27 15:07:31 +00:00
assert rabin_karp_search(pat='RC)', txt='][`') == []
# distances_true = {1: [0], 2: [0], 3: [2], 4: [1]}
# distances_false = {1: [1], 2: [25], 3: [0], 4: [0]}
def test_rabin_karp_search_3(self):
assert rabin_karp_search(pat='*3~', txt='C9`') == []