20 lines
642 B
Python
20 lines
642 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='', txt='m 2') == []
|
||
|
|
||
|
def test_rabin_karp_search_2(self):
|
||
|
assert rabin_karp_search(pat='.w5', txt='55[Ax5X') == []
|
||
|
|
||
|
def test_rabin_karp_search_3(self):
|
||
|
assert rabin_karp_search(pat='h@=y', txt='JcEC') == []
|
||
|
|
||
|
def test_rabin_karp_search_4(self):
|
||
|
assert rabin_karp_search(pat='X', txt='J@X"') == [2]
|
||
|
|
||
|
def test_rabin_karp_search_5(self):
|
||
|
assert rabin_karp_search(pat='>0OPQ', txt='Dzxu8:(P') == []
|