Runs a random test on the given parameters. (Always uses the same random seeds for reproducibility. Can give different seeds on command line.)
| 23 | // (Always uses the same random seeds for reproducibility. |
| 24 | // Can give different seeds on command line.) |
| 25 | static 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. |
| 51 | TEST(Random, SmallEgrepLiterals) { |
no test coverage detected