| 110 | } |
| 111 | |
| 112 | static void BM_EditDistanceHelper(int n, int len, bool completely_different) { |
| 113 | string a = |
| 114 | "The quick brown fox jumped over the lazy dog and on and on and on" |
| 115 | " Every good boy deserves fudge. In fact, this is a very long sentence " |
| 116 | " w/many bytes.."; |
| 117 | while (a.size() < static_cast<size_t>(len)) { |
| 118 | a = a + a; |
| 119 | } |
| 120 | string b = a; |
| 121 | if (completely_different) { |
| 122 | for (size_t i = 0; i < b.size(); i++) { |
| 123 | b[i]++; |
| 124 | } |
| 125 | } |
| 126 | while (n-- > 0) { |
| 127 | LevenshteinDistance(gtl::ArraySlice<char>(a.data(), len), |
| 128 | gtl::ArraySlice<char>(b.data(), len), |
| 129 | std::equal_to<char>()); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | static void BM_EditDistanceSame(int n, int len) { |
| 134 | BM_EditDistanceHelper(n, len, false); |
no test coverage detected