description = '''
complement, intersection, and boolean combination tests.
matches = [[start, end]] in utf8 bytes (half-open intervals).
'''
[[test]]
name = "intersection_string_anchor_multiline"
pattern = '(\A#\[command.*\n.*&_*name_*)'
input = "#[command(name = \"foo\")]\nfn foo() {}\n#[command(name = \"bar\")]\nfn bar() {}"
matches = [[0, 36]]
[[test]]
name = "lookbehind_complement"
pattern = "(?<=__).*&~(.*and.*)"
input = "__ abc and def"
matches = [[2, 9], [9, 14], [14, 14]]
[[test]]
name = "complement_no_double_digits"
pattern = '~(_*\d\d_*)'
input = "Aa11aBaAA"
matches = [[0, 3], [3, 9], [9, 9]]
[[test]]
name = "complement_no_double_digits_long"
pattern = '~(_*\d\d_*)'
input = "Aa11aBabb115454vbsdvfv45AAZ"
matches = [[0, 3], [3, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 23], [23, 27], [27, 27]]
[[test]]
name = "complement_no_newline_pair"
pattern = '~(.*\n\n.*)'
input = "aaa\n\nbbb"
matches = [[0, 4], [4, 8], [8, 8]]
[[test]]
name = "complement_no_and"
pattern = '~(.*and.*)'
input = "__A and B"
matches = [[0, 6], [6, 9], [9, 9]]
[[test]]
name = "complement_no_nd"
pattern = '~(.*nd.*)'
input = "_ndB"
matches = [[0, 2], [2, 4], [4, 4]]
[[test]]
name = "complement_prefix_no_e"
pattern = 'a~(_*e_*)'
input = "abcdefghijklmnop"
matches = [[0, 4]]
[[test]]
name = "complement_prefix_no_bc"
pattern = 'a~(.*bc_*)'
input = "a bc dasdad"
matches = [[0, 6], [9, 14]]
[[test]]
name = "complement_literal_prefix"
pattern = 'asd~(_*nl_*)'
input = "cvbcbcvasdasd nl adasd asdasd"
matches = [[7, 15], [19, 29]]
[[test]]
name = "intersection_four_chars"
pattern = "c...&...s"
input = "raining cats and dogs"
matches = [[8, 12]]
[[test]]
name = "intersection_starts_c_ends_s"
pattern = "c.*&.*s"
input = "cats blah blah blah"
matches = [[0, 4]]
[[test]]
name = "intersection_and_dogs"
pattern = "and.*&.*dogs.*"
input = "raining cats and dogs"
matches = [[13, 21]]
[[test]]
name = "intersection_abc"
pattern = ".*a.*&.*b.*&.*c.*"
input = "abc"
matches = [[0, 3]]
[[test]]
name = "intersection_complement_b"
pattern = 'a.*&~(.*b.*)b'
input = "---a------bbb"
matches = [[3, 11]]
[[test]]
name = "intersection_date_anchored"
pattern = '[0-9]{2}[/.-][0-9]{2}[/.-]([0-9]{4}|[0-9]{2})&^.*$'
input = "01.01.2023"
matches = [[0, 10]]
[[test]]
name = "intersection_date_end_anchor"
pattern = '[0-9]{2}[/.-][0-9]{2}[/.-]([0-9]{4}|[0-9]{2})&.*$'
input = "01.01.2023\n"
matches = [[0, 10]]
[[test]]
name = "complement_intersection_anchor_no_match"
pattern = '~(.*\d\d.*)&^.*$'
input = "Aa11aBaAA"
matches = []
[[test]]
name = "intersection_no_match_multiword"
pattern = ".*which.*&.*could.*&.*that.*&~(.*the.*)"
input = "could only partly conceal the ravages which that long siege of storms had"
matches = []
[[test]]
name = "intersection_subsumption"
pattern = ".*a.*&.*b.*&.*c.*"
input = '"$odd" style="background-color:#f1f1f1">{{ x.Country }}'
matches = [[0, 55]]
[[test]]
name = "complement_intersection_password"
pattern = '~(.*\d\d.*)&[a-zA-Z\d]{8,}'
input = "tej55zhA25wXu8bvQxFxt"
matches = [[9, 21]]
[[test]]
name = "intersection_wildcard_re"
pattern = '(a_*&(~(a.*)|.*b>))'
input = "a_____a____________________b\n"
matches = [[0, 29]]
[[test]]
name = "multiline_paragraph_split"
pattern = '(?:.+\n)+\n'
input = "\naaa\n\nbbb\n\nccc\n\n"
matches = [[1, 6], [6, 11], [11, 16]]
[[test]]
name = "multiline_literal_across_lines"
pattern = "Pu"
input = "[assembly: InternalsVisibleTo(\"Microsoft.Automata.Z3, PublicKey=\" +\n\n[assembly: InternalsVisibleTo(\"Experimentation, PublicKey=\" +"
matches = [[54, 56], [117, 119]]
[[test]]
name = "boolean_f_not_finn"
pattern = "F.*&~(.*Finn)"
input = "Finn', published in 1885."
matches = [[0, 25]]
[[test]]
name = "boolean_huck_not_f"
pattern = ".*Huck.*&~(.*F.*)"
input = "The Adventures of Huckleberry Finn', published in 1885."
matches = [[0, 30]]
[[test]]
name = "lookbehind_intersection"
pattern = "(?<=author).*&.*"
input = "author: abc and def"
matches = [[6, 19]]
[[test]]
name = "lookbehind_lookahead_intersection"
pattern = "(?<=__).*(?=.*def)&.*and.*"
input = "__abc and def"
matches = [[2, 10]]
[[test]]
name = "complement_lookahead"
pattern = '~(.*and.*)(?=.*def)'
input = "__abc and def"
matches = [[0, 8], [8, 10], [10, 10]]
[[test]]
name = "intersection_lookahead_complement"
pattern = ".*(?=.*E)&~(.*and.*)"
input = "___and__E"
matches = [[0, 5], [5, 8], [8, 8]]
[[test]]
name = "intersection_lookahead_same"
pattern = ".*(?=.*def)&.*def"
input = "abcdefdef"
matches = [[0, 6]]
[[test]]
name = "intersection_lookahead_prefix"
pattern = ".*(?=.*def)&.*de"
input = "abcdefdef"
matches = [[0, 5]]
[[test]]
name = "intersection_lookahead_groups"
pattern = "(.*a.*&.*c.*)(?=.*def)"
input = "abcdef"
matches = [[0, 3]]
[[test]]
name = "intersection_lookahead_no_match"
pattern = ".*(?=.*def)&.*def"
input = "abcdef"
matches = []
[[test]]
name = "intersection_lookahead_dash"
pattern = ".*(?=.*-)&.*"
input = "a-"
matches = [[0, 1], [1, 1]]
[[test]]
name = "intersection_lookahead_nospace"
pattern = '.*(?=.*-)&\S.*\S'
input = "-aaaa-"
matches = [[0, 5]]
[[test]]
name = "intersection_start_anchor_multiline"
pattern = '(^#\[command.*\n.*&_*name_*)'
input = "#[command(name = \"foo\")]\nfn foo() {}\n#[command(name = \"bar\")]\nfn bar() {}"
matches = [[0, 36], [37, 73]]
[[test]]
name = "intersection_start_anchor_no_match_mid"
pattern = '(^#\[command.*\n.*&_*name_*)'
input = " #[command(name = \"foo\")]\nfn foo() {}"
matches = []
[[test]]
name = "bounded_dfa_basic_intersection"
pattern = '_*c_*&[a-z]{2,4}'
input = "xycdzz abcde fg"
matches = [[0, 4], [7, 11]]
[[test]]
name = "dotstar_huck_stripped_prefix"
pattern = '.*Huck.*&~(.*F.*)'
input = "The Adventures of Huckleberry Finn', published in 1885."
matches = [[0, 30]]