| OLD | NEW |
| 1 // Copyright 2008 The RE2 Authors. All Rights Reserved. | 1 // Copyright 2008 The RE2 Authors. All Rights Reserved. |
| 2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
| 3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Exhaustive testing of regular expression matching. | 5 // Exhaustive testing of regular expression matching. |
| 6 | 6 |
| 7 // Each test picks an alphabet (e.g., "abc"), a maximum string length, | 7 // Each test picks an alphabet (e.g., "abc"), a maximum string length, |
| 8 // a maximum regular expression length, and a maximum number of letters | 8 // a maximum regular expression length, and a maximum number of letters |
| 9 // that can appear in the regular expression. Given these parameters, | 9 // that can appear in the regular expression. Given these parameters, |
| 10 // it tries every possible regular expression and string, verifying that | 10 // it tries every possible regular expression and string, verifying that |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Runs an exhaustive test on the given parameters. | 144 // Runs an exhaustive test on the given parameters. |
| 145 void ExhaustiveTest(int maxatoms, int maxops, | 145 void ExhaustiveTest(int maxatoms, int maxops, |
| 146 const vector<string>& alphabet, | 146 const vector<string>& alphabet, |
| 147 const vector<string>& ops, | 147 const vector<string>& ops, |
| 148 int maxstrlen, const vector<string>& stralphabet, | 148 int maxstrlen, const vector<string>& stralphabet, |
| 149 const string& wrapper, | 149 const string& wrapper, |
| 150 const string& topwrapper) { | 150 const string& topwrapper) { |
| 151 if (DEBUG_MODE && FLAGS_quick_debug_mode) { | 151 if (RE2_DEBUG_MODE && FLAGS_quick_debug_mode) { |
| 152 if (maxatoms > 1) | 152 if (maxatoms > 1) |
| 153 maxatoms--; | 153 maxatoms--; |
| 154 if (maxops > 1) | 154 if (maxops > 1) |
| 155 maxops--; | 155 maxops--; |
| 156 if (maxstrlen > 1) | 156 if (maxstrlen > 1) |
| 157 maxstrlen--; | 157 maxstrlen--; |
| 158 } | 158 } |
| 159 ExhaustiveTester t(maxatoms, maxops, alphabet, ops, | 159 ExhaustiveTester t(maxatoms, maxops, alphabet, ops, |
| 160 maxstrlen, stralphabet, wrapper, | 160 maxstrlen, stralphabet, wrapper, |
| 161 topwrapper); | 161 topwrapper); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 179 Split("", alphabet), | 179 Split("", alphabet), |
| 180 RegexpGenerator::EgrepOps(), | 180 RegexpGenerator::EgrepOps(), |
| 181 maxstrlen, | 181 maxstrlen, |
| 182 Split("", stralphabet), | 182 Split("", stralphabet), |
| 183 wrapper, | 183 wrapper, |
| 184 tops[i]); | 184 tops[i]); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace re2 | 188 } // namespace re2 |
| OLD | NEW |