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/fuzzer_tests/test_rabin_karp.py

14 lines
584 B
Python

from unittest import TestCase
from benchmark.rabin_karp import rabin_karp_search
class Test_rabin_karp_search(TestCase):
# distances_true = {1: [69, 86], 4: [0, 1], 5: [15]}
# distances_false = {1: [0, 0], 4: [1, 0], 5: [0]}
def test_rabin_karp_search_1(self):
assert rabin_karp_search(pat='Hi', txt=';Wd') == []
# distances_true = {1: [53, 0], 4: [0, 1], 5: [94], 2: [0], 3: [1]}
# distances_false = {1: [0, 1], 4: [1, 0], 5: [0], 2: [47], 3: [0]}
def test_rabin_karp_search_2(self):
assert rabin_karp_search(pat='+g', txt='rZJ') == []