Chromium Code Reviews| Index: net/base/lookup_string_in_fixed_set_unittest.cc |
| diff --git a/net/base/lookup_string_in_fixed_set_unittest.cc b/net/base/lookup_string_in_fixed_set_unittest.cc |
| index 612f6406eaaa4784bb278d996a8b63d126a98741..26b2b2c36c064f4c2fb3dc705081076469892dac 100644 |
| --- a/net/base/lookup_string_in_fixed_set_unittest.cc |
| +++ b/net/base/lookup_string_in_fixed_set_unittest.cc |
| @@ -4,8 +4,6 @@ |
| #include "net/base/lookup_string_in_fixed_set.h" |
| -#include <string.h> |
| - |
| #include <algorithm> |
| #include <limits> |
| #include <ostream> |
| @@ -16,6 +14,7 @@ |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| #include "base/path_service.h" |
| +#include "base/strings/string_piece.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/stringprintf.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -50,8 +49,9 @@ void PrintTo(const Expectation& expectation, std::ostream* os) { |
| class LookupStringInFixedSetTest : public testing::TestWithParam<Expectation> { |
| protected: |
| template <size_t N> |
| - int LookupInGraph(const unsigned char(&graph)[N], const char* key) { |
| - return LookupStringInFixedSet(graph, N, key, strlen(key)); |
| + int LookupInGraph(const unsigned char (&graph)[N], base::StringPiece key) { |
| + std::string rev_key(key.rbegin(), key.rend()); |
|
Ryan Sleevi
2017/03/06 17:20:04
Is it worth documenting why this is reversed?
|
| + return LookupStringInFixedSet(graph, N, rev_key.data(), rev_key.length()); |
| } |
| }; |
| @@ -73,7 +73,7 @@ void RecursivelyEnumerateDafsaLanguage(const FixedSetIncrementalLookup& lookup, |
| std::vector<std::string>* language) { |
| int result = lookup.GetResultForCurrentSequence(); |
| if (result != kDafsaNotFound) { |
| - std::string line(sequence->begin(), sequence->end()); |
| + std::string line(sequence->rbegin(), sequence->rend()); |
|
Ryan Sleevi
2017/03/06 17:20:04
Similarly
|
| line += base::StringPrintf(", %d", result); |
| language->emplace_back(std::move(line)); |
| } |