aboutsummaryrefslogtreecommitdiff
path: root/re2/testing/exhaustive3_test.cc
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2019-02-20 17:18:28 -0500
committerDavid Neto <dneto@google.com>2019-02-21 19:52:57 -0500
commit83d14e6912c72138f77617d225a2f4a8786a9d82 (patch)
tree9ff24faf1e0271a77fbb0019edf793cfc0518a93 /re2/testing/exhaustive3_test.cc
parent03e00e139ba1ef1ac728bb9b78181cf74a6b93be (diff)
parent79ef3b2d31f06493f687ef9e947d9632bad54b9b (diff)
downloadregex-re2-83d14e6912c72138f77617d225a2f4a8786a9d82.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into up-shaderc2
Refresh with content from github.com/google/re2 commit 79ef3b2d31f06493f687ef9e947d9632bad54b9b date 2019-02-13 Change-Id: I4139f29d632e41722992309e96aca4f29c799c87
Diffstat (limited to 're2/testing/exhaustive3_test.cc')
-rw-r--r--re2/testing/exhaustive3_test.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/re2/testing/exhaustive3_test.cc b/re2/testing/exhaustive3_test.cc
index 5613fcb..cf09e18 100644
--- a/re2/testing/exhaustive3_test.cc
+++ b/re2/testing/exhaustive3_test.cc
@@ -4,14 +4,20 @@
// Exhaustive testing of regular expression matching.
+#include <stddef.h>
+#include <memory>
+#include <string>
+#include <vector>
+
#include "util/test.h"
+#include "util/utf.h"
#include "re2/testing/exhaustive_tester.h"
namespace re2 {
// Test simple character classes by themselves.
TEST(CharacterClasses, Exhaustive) {
- vector<string> atoms = Split(" ",
+ std::vector<string> atoms = Split(" ",
"[a] [b] [ab] [^bc] [b-d] [^b-d] []a] [-a] [a-] [^-a] [a-b-c] a b .");
ExhaustiveTest(2, 1, atoms, RegexpGenerator::EgrepOps(),
5, Explode("ab"), "", "");
@@ -19,7 +25,7 @@ TEST(CharacterClasses, Exhaustive) {
// Test simple character classes inside a___b (for example, a[a]b).
TEST(CharacterClasses, ExhaustiveAB) {
- vector<string> atoms = Split(" ",
+ std::vector<string> atoms = Split(" ",
"[a] [b] [ab] [^bc] [b-d] [^b-d] []a] [-a] [a-] [^-a] [a-b-c] a b .");
ExhaustiveTest(2, 1, atoms, RegexpGenerator::EgrepOps(),
5, Explode("ab"), "a%sb", "");
@@ -35,9 +41,9 @@ static string UTF8(Rune r) {
// Returns a vector of "interesting" UTF8 characters.
// Unicode is now too big to just return all of them,
// so UTF8Characters return a set likely to be good test cases.
-static const vector<string>& InterestingUTF8() {
+static const std::vector<string>& InterestingUTF8() {
static bool init;
- static vector<string> v;
+ static std::vector<string> v;
if (init)
return v;
@@ -64,12 +70,12 @@ static const vector<string>& InterestingUTF8() {
// Test interesting UTF-8 characters against character classes.
TEST(InterestingUTF8, SingleOps) {
- vector<string> atoms = Split(" ",
+ std::vector<string> atoms = Split(" ",
". ^ $ \\a \\f \\n \\r \\t \\v \\d \\D \\s \\S \\w \\W \\b \\B "
"[[:alnum:]] [[:alpha:]] [[:blank:]] [[:cntrl:]] [[:digit:]] "
"[[:graph:]] [[:lower:]] [[:print:]] [[:punct:]] [[:space:]] "
"[[:upper:]] [[:xdigit:]] [\\s\\S] [\\d\\D] [^\\w\\W] [^\\d\\D]");
- vector<string> ops; // no ops
+ std::vector<string> ops; // no ops
ExhaustiveTest(1, 0, atoms, ops,
1, InterestingUTF8(), "", "");
}
@@ -77,14 +83,14 @@ TEST(InterestingUTF8, SingleOps) {
// Test interesting UTF-8 characters against character classes,
// but wrap everything inside AB.
TEST(InterestingUTF8, AB) {
- vector<string> atoms = Split(" ",
+ std::vector<string> atoms = Split(" ",
". ^ $ \\a \\f \\n \\r \\t \\v \\d \\D \\s \\S \\w \\W \\b \\B "
"[[:alnum:]] [[:alpha:]] [[:blank:]] [[:cntrl:]] [[:digit:]] "
"[[:graph:]] [[:lower:]] [[:print:]] [[:punct:]] [[:space:]] "
"[[:upper:]] [[:xdigit:]] [\\s\\S] [\\d\\D] [^\\w\\W] [^\\d\\D]");
- vector<string> ops; // no ops
- vector<string> alpha = InterestingUTF8();
- for (int i = 0; i < alpha.size(); i++)
+ std::vector<string> ops; // no ops
+ std::vector<string> alpha = InterestingUTF8();
+ for (size_t i = 0; i < alpha.size(); i++)
alpha[i] = "a" + alpha[i] + "b";
ExhaustiveTest(1, 0, atoms, ops,
1, alpha, "a%sb", "");