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 DECLARE_string(regexp_engines);
13 
14 // Test very simple expressions.
TEST(EgrepLiterals,Lowercase)15 TEST(EgrepLiterals, Lowercase) {
16   EgrepTest(3, 2, "abc.", 3, "abc", "");
17 }
18 
19 // Test mixed-case expressions.
TEST(EgrepLiterals,MixedCase)20 TEST(EgrepLiterals, MixedCase) {
21   EgrepTest(3, 2, "AaBb.", 2, "AaBb", "");
22 }
23 
24 // Test mixed-case in case-insensitive mode.
TEST(EgrepLiterals,FoldCase)25 TEST(EgrepLiterals, FoldCase) {
26   // The punctuation characters surround A-Z and a-z
27   // in the ASCII table.  This looks for bugs in the
28   // bytemap range code in the DFA.
29   EgrepTest(3, 2, "abAB.", 2, "aBc@_~", "(?i:%s)");
30 }
31 
32 // Test very simple expressions.
TEST(EgrepLiterals,UTF8)33 TEST(EgrepLiterals, UTF8) {
34   EgrepTest(3, 2, "ab.", 4, "a\xE2\x98\xBA", "");
35 }
36 
37 }  // namespace re2
38 
39