1 // Copyright 2008 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Exhaustive testing of regular expression matching.
6
7 #include "util/test.h"
8 #include "re2/testing/exhaustive_tester.h"
9
10 namespace re2 {
11
12 // Test very simple expressions.
TEST(EgrepLiterals,Lowercase)13 TEST(EgrepLiterals, Lowercase) {
14 EgrepTest(3, 2, "abc.", 3, "abc", "");
15 }
16
17 // Test mixed-case expressions.
TEST(EgrepLiterals,MixedCase)18 TEST(EgrepLiterals, MixedCase) {
19 EgrepTest(3, 2, "AaBb.", 2, "AaBb", "");
20 }
21
22 // Test mixed-case in case-insensitive mode.
TEST(EgrepLiterals,FoldCase)23 TEST(EgrepLiterals, FoldCase) {
24 // The punctuation characters surround A-Z and a-z
25 // in the ASCII table. This looks for bugs in the
26 // bytemap range code in the DFA.
27 EgrepTest(3, 2, "abAB.", 2, "aBc@_~", "(?i:%s)");
28 }
29
30 // Test very simple expressions.
TEST(EgrepLiterals,UTF8)31 TEST(EgrepLiterals, UTF8) {
32 EgrepTest(3, 2, "ab.", 4, "a\xE2\x98\xBA", "");
33 }
34
35 } // namespace re2
36
37