description = '''
basic engine tests: literals, classes, alternation, greedy quantifiers.
matches = [[start, end]] in utf8 bytes (half-open intervals).
'''
[[test]]
name = "basic_plus"
pattern = '\s?(.+)\n'
input = "!\n !\n"
matches = [[0, 2], [2, 5]]
[[test]]
name = "basic_digit"
pattern = '[\d]{3}-[\d]{4}'
input = "xxxxx000-0000yyyyy"
matches = [[5, 13]]
[[test]]
name = "basic_z"
pattern = '(/|\z)'
input = "xxxxx/yyyyy"
matches = [[5, 6], [11, 11]]
[[test]]
name = "basic_empty"
pattern = "^[/]{0,2}"
input = "abc"
matches = [[0, 0]]
[[test]]
name = "basic_dots"
pattern = ".."
input = "xxxxx!!yyyyy"
matches = [[0, 2], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12]]
[[test]]
name = "basic_literal"
pattern = "abc"
input = "xxabcxx"
matches = [[2, 5]]
[[test]]
name = "multiple_matches"
pattern = "aa"
input = "aaaa"
matches = [[0, 2], [2, 4]]
[[test]]
name = "no_match"
pattern = "xyz"
input = "hello"
matches = []
[[test]]
name = "comment_pattern"
pattern = '/\*[\d\D]*\*/'
input = "/* my comment */"
matches = [[0, 16]]
[[test]]
name = "negated_class"
pattern = "[^F]+"
input = "The Adventures of Huckleberry Finn', published in 1885."
matches = [[0, 30], [31, 55]]
[[test]]
name = "quoted_match"
pattern = 'q.*q'
input = "q my comment q"
matches = [[0, 14]]
[[test]]
name = "alternation_spaces"
pattern = "a( |)b( |)c( |)d"
input = "a b c d"
matches = [[0, 7]]
[[test]]
name = "find_first"
pattern = "ab"
input = "xxabab"
matches = [[2, 4], [4, 6]]
[[test]]
name = "greedy_match"
pattern = "a+"
input = "aaa"
matches = [[0, 3]]
[[test]]
name = "negation_intersection"
pattern = '~(_*(d_*){2})&.*down.*'
input = "asd asd down asdasd asd asd "
matches = [[7, 15]]
[[test]]
name = "alt_no_false_positive_ba"
pattern = "(aa|bb|cc)"
input = "ba"
matches = []
[[test]]
name = "alt_no_false_positive_ab"
pattern = "(aa|bb|cc)"
input = "ab"
matches = []
[[test]]
name = "alt_no_false_positive_ca"
pattern = "(aa|bb|cc)"
input = "ca"
matches = []
[[test]]
name = "alt_correct_match"
pattern = "(aa|bb|cc)"
input = "xbbx"
matches = [[1, 3]]
[[test]]
name = "alt_no_match_in_text"
pattern = "(aa|bb|cc)"
input = "We'll be back."
matches = []
[[test]]
name = "alt_list_hash_no_match"
pattern = "list|hash"
input = "Your blood is good to the last drop."
matches = []
[[test]]
name = "alt_foo_bar_no_match"
pattern = "((foo)|(bar))"
input = "It must have been difficult for..."
matches = []
[[test]]
name = "optional_suffix_correct_start"
pattern = 'Download( (Image|File))?'
input = "Download Download"
matches = [[0, 8], [9, 17]]
[[test]]
name = "optional_suffix_with_match"
pattern = 'Download( (Image|File))?'
input = "Download Image"
matches = [[0, 14]]
[[test]]
name = "nullable_pattern_empty_interspersed"
pattern = '\d{0,7}([\.\|\,]\d{0,2})?'
input = "xxxxx0yyyyy"
matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 6], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11]]
[[test]]
name = "quantifier_a_star_single_run"
pattern = "a*"
input = "bbbbaaabbbbb"
matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 7], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12]]
[[test]]
name = "nullable_head_correctness_abc"
pattern = '\d?abc'
input = "abc"
matches = [[0, 3]]
[[test]]
name = "nullable_head_correctness_1abc"
pattern = '\d?abc'
input = "1abc"
matches = [[0, 4]]
[[test]]
name = "nullable_head_correctness_x1abcx"
pattern = '\d?abc'
input = "x1abcx"
matches = [[1, 5]]
[[test]]
name = "nullable_head_correctness_xabcx"
pattern = '\d?abc'
input = "xabcx"
matches = [[1, 4]]
[[test]]
name = "nullable_head_correctness_11abc"
pattern = '\d?abc'
input = "11abc"
matches = [[1, 5]]
[[test]]
name = "nullable_head_correctness_two_groups"
pattern = '\d?abc'
input = "1abc2abc"
matches = [[0, 4], [4, 8]]
[[test]]
name = "date_optional_time_second_match"
pattern = '\d{4}-\d\d?-\d\d?((T| )\d{2}:\d{2}:\d{2})?'
input = "0000-0-0 0000-0-0"
matches = [[0, 8], [9, 17]]
[[test]]
pattern = '[0-9]{13,19}|([0-9- ]{3,8}){3,6}'
input = "0--------"
matches = [[0, 9]]
[[test]]
name = "dotdotdot"
pattern = 'regex1|regex2|regex3|...|regex15'
input = "r!!"
matches = [[0, 3]]
[[test]]
name = "dotdotdot_escaped"
pattern = '\\(\d{3}|.)'
input = "\\!"
matches = [[0, 2]]
[[test]]
name = "digits_or_hex_or_unicode_or_any"
pattern = '\\(\d{1,3}|x[a-fA-F0-9]+|u[a-fA-F0-9]{1,4}|.|\n)'
input = "xxxxx\\!yyyyy"
matches = [[5, 7]]
[[test]]
name = "both_sided_optional_padding_ws"
pattern = '\s*\S+\s*'
input = "aa bb cc dd ee"
matches = [[0, 3], [3, 6], [6, 9], [9, 12], [12, 14]]
[[test]]
name = "both_sided_optional_padding_space"
pattern = ' *[^ ]+ *'
input = "aa bb cc dd ee"
matches = [[0, 3], [3, 6], [6, 9], [9, 12], [12, 14]]
[[test]]
name = "convergence_variable_gap_px"
pattern = 'P.*X|Q.*Y'
input = "P_X"
matches = [[0, 3]]
[[test]]
name = "convergence_variable_gap_px_short"
pattern = 'P.*X|Q.*Y'
input = "PX"
matches = [[0, 2]]
[[test]]
name = "convergence_variable_gap_qy"
pattern = 'P.*X|Q.*Y'
input = "QzzY"
matches = [[0, 4]]
[[test]]
name = "convergence_variable_gap_py"
pattern = 'P.*X|Q.*Y'
input = "P_Y"
matches = []
[[test]]
name = "ci_literal"
pattern = '(?i)abc'
input = "xAbCx"
matches = [[1, 4]]
[[test]]
name = "ci_literal_no_match"
pattern = '(?i)abc'
input = "xyz"
matches = []
[[test]]
name = "ci_alternation"
pattern = '(?i)(foo|bar)'
input = "FOO and Bar and bAr"
matches = [[0, 3], [8, 11], [16, 19]]
[[test]]
name = "ci_class_range"
pattern = '(?i)[a-f]+'
input = "xABCDEFx"
matches = [[1, 7]]
[[test]]
name = "ci_quantifier"
pattern = '(?i)a+'
input = "aAaA"
matches = [[0, 4]]
[[test]]
name = "ci_bounded_repeat"
pattern = '(?i)ab{2,4}'
input = "aBBBx"
matches = [[0, 4]]
[[test]]
name = "ci_dotstar"
pattern = '(?i)a.*z'
input = "AbcZ"
matches = [[0, 4]]
[[test]]
name = "ci_mixed_case_literal"
pattern = '(?i)HeLLo'
input = "hello HELLO HeLLo hElLo"
matches = [[0, 5], [6, 11], [12, 17], [18, 23]]
[[test]]
name = "ci_word_boundary"
pattern = '(?i)\bhello\b'
input = "Hello HELLO hello"
matches = [[0, 5], [6, 11], [12, 17]]
[[test]]
name = "ci_digits_unaffected"
pattern = '(?i)test123'
input = "TEST123 test123 TeSt123"
matches = [[0, 7], [8, 15], [16, 23]]
[[test]]
name = "ci_char_class_explicit"
pattern = '(?i)[xyz]+'
input = "XyZxYz"
matches = [[0, 6]]
[[test]]
name = "ci_negated_class"
pattern = '(?i)[^a-c]+'
input = "xABCxDEFx"
matches = [[0, 1], [4, 9]]
[[test]]
name = "ci_anchored_start"
pattern = '(?i)^hello'
input = "Hello world"
matches = [[0, 5]]
[[test]]
name = "ci_anchored_end"
pattern = '(?i)world$'
input = "hello WORLD"
matches = [[6, 11]]
[[test]]
name = "ci_anchored_full"
pattern = '(?i)^hello world$'
input = "HELLO WORLD"
matches = [[0, 11]]
[[test]]
name = "ci_anchored_no_match"
pattern = '(?i)^hello$'
input = "xhellox"
matches = []
[[test]]
name = "ci_optional"
pattern = '(?i)colou?r'
input = "Color COLOUR color colour"
matches = [[0, 5], [6, 12], [13, 18], [19, 25]]
[[test]]
name = "ci_plus_quantifier"
pattern = '(?i)z+'
input = "zZzZZz"
matches = [[0, 6]]
[[test]]
name = "ci_star_quantifier"
pattern = '(?i)ab*c'
input = "AC ABC ABBC ac abc"
matches = [[0, 2], [3, 6], [7, 11], [12, 14], [15, 18]]
[[test]]
name = "ci_escape_sequence"
pattern = '(?i)\d+[a-f]+'
input = "123ABC 456def 789aF"
matches = [[0, 6], [7, 13], [14, 19]]
[[test]]
name = "ci_lookahead"
pattern = '(?i)foo(?=bar)'
input = "FOOBAR foobar FoObAr foobaz"
matches = [[0, 3], [7, 10], [14, 17]]
[[test]]
name = "ci_lookbehind"
pattern = '(?i)(?<=foo)bar'
input = "FOOBAR foobar FoObAr bazbar"
matches = [[3, 6], [10, 13], [17, 20]]
[[test]]
name = "ci_empty_input"
pattern = '(?i)abc'
input = ""
matches = []
[[test]]
name = "ci_single_char"
pattern = '(?i)a'
input = "AaAa"
matches = [[0, 1], [1, 2], [2, 3], [3, 4]]
[[test]]
name = "ci_unicode_ascii"
pattern = '(?i)caf'
input = "CAF caf Caf"
matches = [[0, 3], [4, 7], [8, 11]]
[[test]]
name = "ci_pipe_in_group"
pattern = '(?i)(cat|dog|bird)'
input = "CAT Dog BIRD cat"
matches = [[0, 3], [4, 7], [8, 12], [13, 16]]
[[test]]
name = "ci_nested_groups"
pattern = '(?i)(a(bc)d)'
input = "ABCD abcd AbCd"
matches = [[0, 4], [5, 9], [10, 14]]
[[test]]
name = "ci_exact_repeat"
pattern = '(?i)a{3}'
input = "aAa AAA aaa"
matches = [[0, 3], [4, 7], [8, 11]]
[[test]]
name = "ci_range_repeat"
pattern = '(?i)x{2,4}'
input = "xX XXx xXxX"
matches = [[0, 2], [3, 6], [7, 11]]
[[test]]
name = "ci_scoped"
pattern = '(?i:abc)def'
input = "ABCdef abcDEF ABCDef abcdef"
matches = [[0, 6], [21, 27]]
[[test]]
name = "ci_scoped_no_leak"
pattern = '(?i:abc)def'
input = "ABCDEF"
matches = []
[[test]]
name = "ci_scoped_alternation"
pattern = '(?i:foo|bar)baz'
input = "FOObaz BARbaz foobaz FOOBAZ"
matches = [[0, 6], [7, 13], [14, 20]]
[[test]]
name = "ci_scoped_class"
pattern = '(?i:[a-f])+g'
input = "ABCDEFg abcdefg ABCDEfG"
matches = [[0, 7], [8, 15]]
[[test]]
name = "ci_scoped_nested"
pattern = '(?i:a(?-i:b)c)'
input = "AbC ABC abc aBc"
matches = [[0, 3], [8, 11]]