def test_in(self): text = 'annbcdanacadsannannabnna' pattern = 'annann' self.assertEqual(text.find(pattern), kmp(text, pattern)) text = 'abcabcabcabcabcdabcacabcabcacb' pattern = 'dabc' self.assertEqual(text.find(pattern), kmp(text, pattern))
def test_in(self): text = 'annbcdanacadsannannabnna' pattern = 'annann' self.assertEqual(text.find(pattern), kmp(text, pattern) ) text = 'abcabcabcabcabcdabcacabcabcacb' pattern = 'dabc' self.assertEqual(text.find(pattern), kmp(text, pattern) )
def test_notin(self): text = 'annbcdanacadsannannabnna' pattern = 'annacanna' self.assertEqual(text.find(pattern), kmp(text, pattern) )
def test_notin(self): text = 'annbcdanacadsannannabnna' pattern = 'annacanna' self.assertEqual(text.find(pattern), kmp(text, pattern))