def test_star_2(self): expr = StateSplit(None, StateMatch()) expr.out = StateChar('a', expr) result = find2(expr, 'aaaaaaaabacbca', 0) assert list(result) == [ (1, 8), (9, 8), (10, 10), (11, 10), (12, 11), (13, 12), (14, 14) ]
def test_star_1(self): expr = StateSplit(None, StateMatch()) expr.out = StateChar('c', expr) result = find2(expr, 'aaaabacccca', 0) assert list(result) == [ (1, 0), (2, 1), (3, 2), (4, 3), (5, 4), (6, 5), (7, 10), (11, 10) ]
def test_star_between_chars_star_match_end(self): star = StateSplit(None, StateMatch()) star.out = StateChar('b', star) expr = StateChar('a', star) result = find2(expr, 'acjjjabcabbbbb', 0) assert list(result) == [(1, 1), (6, 7), (9, 14)]
def test_single_char_no_match(self): expr = StateChar('c', StateMatch()) result = find2(expr, 'xyz', 0) assert list(result) == [(-1, -1)]
def test_three_chars_big_offset(self): expr = StateChar('a', StateChar('b', StateChar('c', StateMatch()))) result = find2(expr, 'abcjjjabc', 100) assert list(result) == [(-1, -1)]
def test_three_chars_negative_offset_no_match(self): expr = StateChar('a', StateChar('b', StateChar('c', StateMatch()))) result = find2(expr, 'abcjjjabc', -2) assert list(result) == [(-1, -1)]
def test_three_chars_big_negative_offset_match(self): expr = StateChar('a', StateChar('b', StateChar('c', StateMatch()))) result = find2(expr, 'abcjjjabc', -100) assert list(result) == [(1, 3), (7, 9)]
def test_three_chars_two_matches(self): expr = StateChar('a', StateChar('b', StateChar('c', StateMatch()))) result = find2(expr, 'babcccabababccbababacccbaccabbbc', 0) assert list(result) == [(2, 4), (11, 13)]
def test_three_chars_one_matches_offset(self): expr = StateChar('a', StateChar('b', StateChar('c', StateMatch()))) result = find2(expr, 'abcjjjabc', 4) assert list(result) == [(7, 9)]
def tests_find_two_chars_matches(self): expr = StateChar('a', StateChar('b', StateMatch())) result = find2(expr, 'baaaabbacaabbcc', 0) assert list(result) == [(5, 6), (11, 12)]
def test_three_chars_one_match(self): expr = StateChar('a', StateChar('b', StateChar('c', StateMatch()))) result = find2(expr, 'ccabababccbababacccbaccabbbc', 0) assert list(result) == [(7, 9)]
def test_two_chars_one_match(self): expr = StateChar('a', StateChar('b', StateMatch())) result = find2(expr, 'ccvvvbbajbajbabb', 0) assert list(result) == [(14, 15)]
def test_two_chars_no_matches(self): expr = StateChar('a', StateChar('b', StateMatch())) result = find2(expr, 'acbaaubbbbb', 0) assert list(result) == [(-1, -1)]
def test_single_char_more_matches(self): expr = StateChar('c', StateMatch()) result = find2(expr, 'xyzaaaccaa', 0) assert list(result) == [(7, 7), (8, 8)]
def test_single_char_one_match(self): expr = StateChar('c', StateMatch()) result = find2(expr, 'asdasdxcz', 0) assert list(result) == [(8, 8)]
def test_star_between_chars_match_star(self): star = StateSplit(None, StateChar('c', StateMatch())) star.out = StateChar('b', star) expr = StateChar('a', star) result = find2(expr, 'xaabbbbbcjjjabcxalcac', 0) assert list(result) == [(3, 9), (13, 15), (20, 21)]