Go to the documentation of this file.
10 #include "util/test.h"
11 #include "util/logging.h"
12 #include "util/strutil.h"
15 #include "re2/regexp.h"
16 #include "re2/testing/regexp_generator.h"
17 #include "re2/testing/string_generator.h"
34 TEST(Multithreaded, BuildEntireDFA) {
37 for (
int i = 0;
i < FLAGS_size;
i++)
55 for (
int i = 0;
i < FLAGS_repeat;
i++) {
59 std::vector<std::thread>
threads;
60 for (
int j = 0; j < FLAGS_threads; j++)
62 for (
int j = 0; j < FLAGS_threads; j++)
76 TEST(SingleThreaded, BuildEntireDFA) {
81 for (
int i = 17;
i < 24;
i++) {
120 CHECK_LT(
n,
static_cast<int>(8*
sizeof(
int)));
123 std::vector<bool> did(
size_t{1}<<
n);
124 for (
int i = 0;
i < 1<<
n;
i++)
128 for (
int i = 0;
i <
n-1;
i++)
131 int mask = (1<<
n) - 1;
132 for (
int i = 0;
i < (1<<
n);
i++) {
192 for (
int i = 0;
i < 10;
i++) {
193 bool matched =
false;
205 peak_usage =
m.PeakHeapGrowth();
224 for (
int i = 0;
i < 2;
i++) {
225 bool matched =
false;
262 for (
int i = 0;
i < FLAGS_repeat;
i++) {
266 std::vector<std::thread>
threads;
267 for (
int j = 0; j < FLAGS_threads; j++)
269 for (
int j = 0; j < FLAGS_threads; j++)
290 {
"\\A(a|b)",
"abc",
true },
291 {
"(a|b)\\z",
"cba",
true },
292 {
"\\A(a|b)",
"cba",
false },
293 {
"(a|b)\\z",
"abc",
false },
307 if (matched != t.match) {
308 LOG(
ERROR) << t.regexp <<
" on " << t.text <<
": want " << t.match;
339 {
"\\Aa\\z",
"[-1,1,-1] [-1,-1,2] [[-1,-1,-1]]" },
340 {
"\\Aab\\z",
"[-1,1,-1,-1] [-1,-1,2,-1] [-1,-1,-1,3] [[-1,-1,-1,-1]]" },
341 {
"\\Aa*b\\z",
"[-1,0,1,-1] [-1,-1,-1,2] [[-1,-1,-1,-1]]" },
342 {
"\\Aa+b\\z",
"[-1,1,-1,-1] [-1,1,2,-1] [-1,-1,-1,3] [[-1,-1,-1,-1]]" },
343 {
"\\Aa?b\\z",
"[-1,1,2,-1] [-1,-1,2,-1] [-1,-1,-1,3] [[-1,-1,-1,-1]]" },
344 {
"\\Aa\\C*\\z",
"[-1,1,-1] [1,1,2] [[-1,-1,-1]]" },
345 {
"\\Aa\\C*",
"[-1,1,-1] [2,2,3] [[2,2,2]] [[-1,-1,-1]]" },
346 {
"a\\C*",
"[0,1,-1] [2,2,3] [[2,2,2]] [[-1,-1,-1]]" },
347 {
"\\C*",
"[1,2] [[1,1]] [[-1,-1]]" },
348 {
"a",
"[0,1,-1] [2,2,2] [[-1,-1,-1]]"} ,
364 dump +=
match ?
"[[" :
"[";
365 for (
int b = 0;
b <
prog->bytemap_range() + 1;
b++)
368 dump +=
match ?
"]]" :
"]";
370 if (dump != t.dump) {
371 LOG(
ERROR) << t.regexp <<
" bytemap:\n" <<
prog->DumpByteMap();
372 LOG(
ERROR) << t.regexp <<
" dump:\ngot " << dump <<
"\nwant " << t.dump;
static void DoSearch(Prog *prog, const StringPiece &match, const StringPiece &no_match)
ReverseTest reverse_tests[]
unsigned char match[65280+2]
Prog * CompileToProg(int64_t max_mem)
static uv_thread_t * threads
static const bool UsingMallocCounter
#define ASSERT_LT(val1, val2)
std::string StringPrintf(const char *format,...)
DEFINE_int32(size, 8, "log2(number of DFA nodes)")
OPENSSL_EXPORT ASN1_BIT_STRING * bits
static Regexp * Parse(const StringPiece &s, ParseFlags flags, RegexpStatus *status)
static const LogLevel ERROR
Prog * CompileToReverseProg(int64_t max_mem)
static std::string DeBruijnString(int n)
static void DoBuild(Prog *prog)
CallbackTest callback_tests[]
AllocList * next[kMaxLevel]
#define ASSERT_TRUE(condition)
#define ASSERT_FALSE(condition)
static void TEST_dfa_should_bail_when_slow(bool b)
static const int THIS_THREAD_ONLY
TEST(TestCharClassBuilder, Adds)
#define ASSERT_GT(val1, val2)
static uv_thread_t thread
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:16