Ejemplo n.º 1
0
 def test_find_sequence_max_1(self):
     a_int = ord('a')
     seq = ''.join(map(chr, range(a_int, a_int + LZ77.max_seq + 1)))
     text = seq * 2
     actual, pos = LZ77.find_best_subsequence(text, len(seq))
     expected = seq[:LZ77.max_seq]
     self.assertEqual(actual, expected)
Ejemplo n.º 2
0
 def test_find_sequence_max_1_pos(self):
     text = 'abc' + ('d' * (LZ77.max_block - 2)) + 'abc'
     actual, pos = LZ77.find_best_subsequence(text, LZ77.max_block + 1)
     expected = ''
     self.assertEqual(actual, expected)
Ejemplo n.º 3
0
 def test_find_sequence_pos1(self):
     text = 'abab'
     actual, pos = LZ77.find_best_subsequence(text, 2)
     expected = 'ab'
     self.assertEqual(actual, expected)
     self.assertEqual(pos, 0)
Ejemplo n.º 4
0
 def test_find_sequence_neg2(self):
     text = 'aabbxbb'
     actual, pos = LZ77.find_best_subsequence(text, 2)
     expected = ''
     self.assertEqual(actual, expected)
Ejemplo n.º 5
0
 def test_find_sequence_best(self):
     text = 'abcabcdeabcd'
     actual, pos = LZ77.find_best_subsequence(text, 8)
     expected = 'abcd'
     self.assertEqual(actual, expected)
Ejemplo n.º 6
0
 def test_find_sequence_pos3(self):
     text = 'abbbabb'
     actual, pos = LZ77.find_best_subsequence(text, 4)
     expected = 'abb'
     self.assertEqual(actual, expected)