#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/omnibox/browser/history_fuzzy_provider.h"
#include <vector>
#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
struct TestCase { … };
template <typename Container, typename Item>
void SwapRemoveElement(Container& container, const Item& item) { … }
std::ostream& operator<<(std::ostream& os, const fuzzy::Edit& edit) { … }
std::ostream& operator<<(std::ostream& os,
const fuzzy::Correction& correction) { … }
void VerifyTestCase(fuzzy::Node* node,
TestCase& test_case,
fuzzy::ToleranceSchedule tolerance_schedule) { … }
void VerifyCases(fuzzy::Node* node, std::vector<TestCase>& cases) { … }
void VerifyCasesWithSchedule(fuzzy::Node* node,
std::vector<TestCase>& cases,
fuzzy::ToleranceSchedule tolerance_schedule) { … }
}
class HistoryFuzzyProviderTest : public testing::Test { … };
TEST_F(HistoryFuzzyProviderTest, AlgorithmIsNotGreedy) { … }
TEST_F(HistoryFuzzyProviderTest, ReplacementWorksAnywhere) { … }
TEST_F(HistoryFuzzyProviderTest, InsertionWorksAnywhereExceptEnd) { … }
TEST_F(HistoryFuzzyProviderTest, DeletionWorksAnywhere) { … }
TEST_F(HistoryFuzzyProviderTest, LongerResultsArePreferred) { … }
TEST_F(HistoryFuzzyProviderTest, EmptyTrieRespectsToleranceSchedule) { … }
TEST_F(HistoryFuzzyProviderTest, ToleranceScheduleIsEnforced) { … }
TEST_F(HistoryFuzzyProviderTest, TransposeIsEditDistanceOne) { … }
TEST_F(HistoryFuzzyProviderTest, DoesNotProduceDuplicate) { … }
TEST_F(HistoryFuzzyProviderTest, NodesDeleteAndPreserveStructure) { … }
TEST_F(HistoryFuzzyProviderTest, NodesMaintainRelevanceTotalTerminalCount) { … }