16 lines
559 B
Python
16 lines
559 B
Python
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]
|