MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / RandomTest

Function RandomTest

extern/re2/re2/testing/random_test.cc:25–48  ·  view source on GitHub ↗

Runs a random test on the given parameters. (Always uses the same random seeds for reproducibility. Can give different seeds on command line.)

Source from the content-addressed store, hash-verified

23// (Always uses the same random seeds for reproducibility.
24// Can give different seeds on command line.)
25static void RandomTest(int maxatoms, int maxops,
26 const std::vector<std::string>& alphabet,
27 const std::vector<std::string>& ops,
28 int maxstrlen,
29 const std::vector<std::string>& stralphabet,
30 const std::string& wrapper) {
31 // Limit to smaller test cases in debug mode,
32 // because everything is so much slower.
33 if (RE2_DEBUG_MODE) {
34 maxatoms--;
35 maxops--;
36 maxstrlen /= 2;
37 }
38
39 ExhaustiveTester t(maxatoms, maxops, alphabet, ops,
40 maxstrlen, stralphabet, wrapper, "");
41 t.RandomStrings(GetFlag(FLAGS_stringseed),
42 GetFlag(FLAGS_stringcount));
43 t.GenerateRandom(GetFlag(FLAGS_regexpseed),
44 GetFlag(FLAGS_regexpcount));
45 printf("%d regexps, %d tests, %d failures [%d/%d str]\n",
46 t.regexps(), t.tests(), t.failures(), maxstrlen, (int)stralphabet.size());
47 EXPECT_EQ(0, t.failures());
48}
49
50// Tests random small regexps involving literals and egrep operators.
51TEST(Random, SmallEgrepLiterals) {

Callers 1

TESTFunction · 0.85

Calls 7

GetFlagFunction · 0.85
RandomStringsMethod · 0.80
GenerateRandomMethod · 0.80
failuresMethod · 0.80
regexpsMethod · 0.45
testsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected