# Path: string_algorithms/search/knuth_morris_pratt.py
# def kmp(text, pattern, start_index=0):
#     failure_array = construct_failure_array(pattern)
#     j = 0
#     m = len(pattern)
#     i = start_index
#     while True:
#         if i >= len(text):
#             break
# 
#         if text[i] == pattern[j]:
#             j += 1
#             i += 1
#             if j == m:
#                 return i - m
#         elif j > 0:
#             j = failure_array[j]
#         else:
#             i += 1
# 
#     return -1


from unittest.case import TestCase
from string_algorithms.search.knuth_morris_pratt import kmp


class KmpTests(TestCase):

    def get_strings(self):
        return "abcdabcdabcdabcdabcdabcdabcdabcd", "bcd"

    def test_search1(self):
        text, pattern = self.get_strings()


# Path: string_algorithms/search/knuth_morris_pratt.py
# def kmp(text, pattern, start_index=0):
#     failure_array = construct_failure_array(pattern)
#     j = 0
#     m = len(pattern)
#     i = start_index
#     while True:
#         if i >= len(text):
#             break
# 
#         if text[i] == pattern[j]:
#             j += 1
#             i += 1
#             if j == m:
#                 return i - m
#         elif j > 0:
#             j = failure_array[j]
#         else:
#             i += 1
# 
#     return -1


# Path: tests/string_algorithms/search/kmp_tests.py
from unittest.case import TestCase
from string_algorithms.search.knuth_morris_pratt import kmp



class KmpTests(TestCase):

    def get_strings(self):
        return "abcdabcdabcdabcdabcdabcdabcdabcd", "bcd"

    def test_search1(self):
        text, pattern = self.get_strings()


        ind = kmp(text, pattern)