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

17 lines
559 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):
def test_rabin_karp_search_1(self):
assert rabin_karp_search(pat='3gx!', txt='~*J~%eC') == [0]
def test_rabin_karp_search_2(self):
assert rabin_karp_search(pat='`gO7Vq!kU', txt='=DLaH\\p~[') == []
def test_rabin_karp_search_3(self):
assert rabin_karp_search(pat='', txt='%gxypQ7L') == []
def test_rabin_karp_search_4(self):
assert rabin_karp_search(pat='@', txt='H@@|DPma"') == [1, 2]