def test_simple_lcp_search_abracadabra_contains_cada(self): text = "abracadabra$" suffix_array = [11, 10, 7, 0, 3, 5, 8, 1, 4, 6, 9, 2] substring = "cada" expected = 4 computed = simple_lcp_search(text, suffix_array, substring) self.assertEquals(computed, expected)
def test_simple_lcp_search_tobeornottobe_contains_tobeornottobe(self): text = "tobeornottobe$" suffix_array = [13, 11, 2, 12, 3, 6, 10, 1, 4, 7, 5, 9, 0, 8] substring = "tobeornottobe$" expected = 0 computed = simple_lcp_search(text, suffix_array, substring) self.assertEquals(computed, expected)
def test_brutal_test(self): text = fixture_text suffix_array = SuffixArray(text) array = suffix_array.process() substrings = [\ ',\nstimulants, depres', 'f a ship provides it'] for substring in substrings: answer = simple_lcp_search(text, array, substring) self.assertEquals(substring, text[answer: answer + len(substring)])