1c67d6573Sopenharmony_ci// Many of these are cribbed from RE2's test suite.
2c67d6573Sopenharmony_ci
3c67d6573Sopenharmony_cimatiter!(wb1, r"\b", "");
4c67d6573Sopenharmony_cimatiter!(wb2, r"\b", "a", (0, 0), (1, 1));
5c67d6573Sopenharmony_cimatiter!(wb3, r"\b", "ab", (0, 0), (2, 2));
6c67d6573Sopenharmony_cimatiter!(wb4, r"^\b", "ab", (0, 0));
7c67d6573Sopenharmony_cimatiter!(wb5, r"\b$", "ab", (2, 2));
8c67d6573Sopenharmony_cimatiter!(wb6, r"^\b$", "ab");
9c67d6573Sopenharmony_cimatiter!(wb7, r"\bbar\b", "nobar bar foo bar", (6, 9), (14, 17));
10c67d6573Sopenharmony_cimatiter!(wb8, r"a\b", "faoa x", (3, 4));
11c67d6573Sopenharmony_cimatiter!(wb9, r"\bbar", "bar x", (0, 3));
12c67d6573Sopenharmony_cimatiter!(wb10, r"\bbar", "foo\nbar x", (4, 7));
13c67d6573Sopenharmony_cimatiter!(wb11, r"bar\b", "foobar", (3, 6));
14c67d6573Sopenharmony_cimatiter!(wb12, r"bar\b", "foobar\nxxx", (3, 6));
15c67d6573Sopenharmony_cimatiter!(wb13, r"(foo|bar|[A-Z])\b", "foo", (0, 3));
16c67d6573Sopenharmony_cimatiter!(wb14, r"(foo|bar|[A-Z])\b", "foo\n", (0, 3));
17c67d6573Sopenharmony_cimatiter!(wb15, r"\b(foo|bar|[A-Z])", "foo", (0, 3));
18c67d6573Sopenharmony_cimatiter!(wb16, r"\b(foo|bar|[A-Z])\b", "X", (0, 1));
19c67d6573Sopenharmony_cimatiter!(wb17, r"\b(foo|bar|[A-Z])\b", "XY");
20c67d6573Sopenharmony_cimatiter!(wb18, r"\b(foo|bar|[A-Z])\b", "bar", (0, 3));
21c67d6573Sopenharmony_cimatiter!(wb19, r"\b(foo|bar|[A-Z])\b", "foo", (0, 3));
22c67d6573Sopenharmony_cimatiter!(wb20, r"\b(foo|bar|[A-Z])\b", "foo\n", (0, 3));
23c67d6573Sopenharmony_cimatiter!(wb21, r"\b(foo|bar|[A-Z])\b", "ffoo bbar N x", (10, 11));
24c67d6573Sopenharmony_cimatiter!(wb22, r"\b(fo|foo)\b", "fo", (0, 2));
25c67d6573Sopenharmony_cimatiter!(wb23, r"\b(fo|foo)\b", "foo", (0, 3));
26c67d6573Sopenharmony_cimatiter!(wb24, r"\b\b", "");
27c67d6573Sopenharmony_cimatiter!(wb25, r"\b\b", "a", (0, 0), (1, 1));
28c67d6573Sopenharmony_cimatiter!(wb26, r"\b$", "");
29c67d6573Sopenharmony_cimatiter!(wb27, r"\b$", "x", (1, 1));
30c67d6573Sopenharmony_cimatiter!(wb28, r"\b$", "y x", (3, 3));
31c67d6573Sopenharmony_cimatiter!(wb29, r"\b.$", "x", (0, 1));
32c67d6573Sopenharmony_cimatiter!(wb30, r"^\b(fo|foo)\b", "fo", (0, 2));
33c67d6573Sopenharmony_cimatiter!(wb31, r"^\b(fo|foo)\b", "foo", (0, 3));
34c67d6573Sopenharmony_cimatiter!(wb32, r"^\b$", "");
35c67d6573Sopenharmony_cimatiter!(wb33, r"^\b$", "x");
36c67d6573Sopenharmony_cimatiter!(wb34, r"^\b.$", "x", (0, 1));
37c67d6573Sopenharmony_cimatiter!(wb35, r"^\b.\b$", "x", (0, 1));
38c67d6573Sopenharmony_cimatiter!(wb36, r"^^^^^\b$$$$$", "");
39c67d6573Sopenharmony_cimatiter!(wb37, r"^^^^^\b.$$$$$", "x", (0, 1));
40c67d6573Sopenharmony_cimatiter!(wb38, r"^^^^^\b$$$$$", "x");
41c67d6573Sopenharmony_cimatiter!(wb39, r"^^^^^\b\b\b.\b\b\b$$$$$", "x", (0, 1));
42c67d6573Sopenharmony_cimatiter!(wb40, r"\b.+\b", "$$abc$$", (2, 5));
43c67d6573Sopenharmony_cimatiter!(wb41, r"\b", "a b c", (0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5));
44c67d6573Sopenharmony_ci
45c67d6573Sopenharmony_cimatiter!(nb1, r"\Bfoo\B", "n foo xfoox that", (7, 10));
46c67d6573Sopenharmony_cimatiter!(nb2, r"a\B", "faoa x", (1, 2));
47c67d6573Sopenharmony_cimatiter!(nb3, r"\Bbar", "bar x");
48c67d6573Sopenharmony_cimatiter!(nb4, r"\Bbar", "foo\nbar x");
49c67d6573Sopenharmony_cimatiter!(nb5, r"bar\B", "foobar");
50c67d6573Sopenharmony_cimatiter!(nb6, r"bar\B", "foobar\nxxx");
51c67d6573Sopenharmony_cimatiter!(nb7, r"(foo|bar|[A-Z])\B", "foox", (0, 3));
52c67d6573Sopenharmony_cimatiter!(nb8, r"(foo|bar|[A-Z])\B", "foo\n");
53c67d6573Sopenharmony_cimatiter!(nb9, r"\B", "", (0, 0));
54c67d6573Sopenharmony_cimatiter!(nb10, r"\B", "x");
55c67d6573Sopenharmony_cimatiter!(nb11, r"\B(foo|bar|[A-Z])", "foo");
56c67d6573Sopenharmony_cimatiter!(nb12, r"\B(foo|bar|[A-Z])\B", "xXy", (1, 2));
57c67d6573Sopenharmony_cimatiter!(nb13, r"\B(foo|bar|[A-Z])\B", "XY");
58c67d6573Sopenharmony_cimatiter!(nb14, r"\B(foo|bar|[A-Z])\B", "XYZ", (1, 2));
59c67d6573Sopenharmony_cimatiter!(nb15, r"\B(foo|bar|[A-Z])\B", "abara", (1, 4));
60c67d6573Sopenharmony_cimatiter!(nb16, r"\B(foo|bar|[A-Z])\B", "xfoo_", (1, 4));
61c67d6573Sopenharmony_cimatiter!(nb17, r"\B(foo|bar|[A-Z])\B", "xfoo\n");
62c67d6573Sopenharmony_cimatiter!(nb18, r"\B(foo|bar|[A-Z])\B", "foo bar vNX", (9, 10));
63c67d6573Sopenharmony_cimatiter!(nb19, r"\B(fo|foo)\B", "xfoo", (1, 3));
64c67d6573Sopenharmony_cimatiter!(nb20, r"\B(foo|fo)\B", "xfooo", (1, 4));
65c67d6573Sopenharmony_cimatiter!(nb21, r"\B\B", "", (0, 0));
66c67d6573Sopenharmony_cimatiter!(nb22, r"\B\B", "x");
67c67d6573Sopenharmony_cimatiter!(nb23, r"\B$", "", (0, 0));
68c67d6573Sopenharmony_cimatiter!(nb24, r"\B$", "x");
69c67d6573Sopenharmony_cimatiter!(nb25, r"\B$", "y x");
70c67d6573Sopenharmony_cimatiter!(nb26, r"\B.$", "x");
71c67d6573Sopenharmony_cimatiter!(nb27, r"^\B(fo|foo)\B", "fo");
72c67d6573Sopenharmony_cimatiter!(nb28, r"^\B(fo|foo)\B", "foo");
73c67d6573Sopenharmony_cimatiter!(nb29, r"^\B", "", (0, 0));
74c67d6573Sopenharmony_cimatiter!(nb30, r"^\B", "x");
75c67d6573Sopenharmony_cimatiter!(nb31, r"^\B\B", "", (0, 0));
76c67d6573Sopenharmony_cimatiter!(nb32, r"^\B\B", "x");
77c67d6573Sopenharmony_cimatiter!(nb33, r"^\B$", "", (0, 0));
78c67d6573Sopenharmony_cimatiter!(nb34, r"^\B$", "x");
79c67d6573Sopenharmony_cimatiter!(nb35, r"^\B.$", "x");
80c67d6573Sopenharmony_cimatiter!(nb36, r"^\B.\B$", "x");
81c67d6573Sopenharmony_cimatiter!(nb37, r"^^^^^\B$$$$$", "", (0, 0));
82c67d6573Sopenharmony_cimatiter!(nb38, r"^^^^^\B.$$$$$", "x");
83c67d6573Sopenharmony_cimatiter!(nb39, r"^^^^^\B$$$$$", "x");
84c67d6573Sopenharmony_ci
85c67d6573Sopenharmony_ci// These work for both Unicode and ASCII because all matches are reported as
86c67d6573Sopenharmony_ci// byte offsets, and « and » do not correspond to word boundaries at either
87c67d6573Sopenharmony_ci// the character or byte level.
88c67d6573Sopenharmony_cimatiter!(unicode1, r"\bx\b", "«x", (2, 3));
89c67d6573Sopenharmony_cimatiter!(unicode2, r"\bx\b", "x»", (0, 1));
90