| 38 | } |
| 39 | |
| 40 | void test() { |
| 41 | /* Field testing: Kattis stringmultimatching, Codeforces 366C */ |
| 42 | |
| 43 | int ts = 100, |
| 44 | ts2 = 10; |
| 45 | |
| 46 | for (int t = 0; t < ts; t++) { |
| 47 | int n = rng() % 1000; |
| 48 | |
| 49 | vector<string> kws; |
| 50 | for (int i = 0; i < n; i++) { |
| 51 | kws.push_back(random_string(rng() % 10 + 1, rng() % 5 + 1)); |
| 52 | } |
| 53 | |
| 54 | aho_corasick ac(kws); |
| 55 | aho_corasick_slow ac2(kws); |
| 56 | |
| 57 | for (int p = 0; p < ts2; p++) { |
| 58 | string s = random_string(rng() % 100, rng() % 5 + 1); |
| 59 | vector<string> res = ac.search(s); |
| 60 | vector<string> res2 = ac2.search(s); |
| 61 | sort(res.begin(), res.end()); |
| 62 | sort(res2.begin(), res2.end()); |
| 63 | |
| 64 | assert_equal(size(res2), size(res)); |
| 65 | |
| 66 | for (int i = 0; i < size(res); i++) { |
| 67 | assert_equal(res2[i], res[i]); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | // vim: cc=60 ts=2 sts=2 sw=2: |
nothing calls this directly
no test coverage detected