//===-- FuzzyMatchTests.cpp - String fuzzy matcher tests --------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "FuzzyMatch.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include <optional> namespace clang { namespace clangd { namespace { Not; struct ExpectedMatch { … }; struct MatchesMatcher : public ::testing::MatcherInterface<llvm::StringRef> { … }; // Accepts patterns that match a given word, optionally requiring a score. // Dumps the debug tables on match failure. ::testing::Matcher<llvm::StringRef> matches(llvm::StringRef M, std::optional<float> Score = { … } TEST(FuzzyMatch, Matches) { … } struct RankMatcher : public ::testing::MatcherInterface<llvm::StringRef> { … }; // Accepts patterns that match all the strings and rank them in the given order. // Dumps the debug tables on match failure. template <typename... T> ::testing::Matcher<llvm::StringRef> ranks(T... RankedStrings) { … } TEST(FuzzyMatch, Ranking) { … } // Verify some bounds so we know scores fall in the right range. // Testing exact scores is fragile, so we prefer Ranking tests. TEST(FuzzyMatch, Scoring) { … } TEST(FuzzyMatch, InitialismAndPrefix) { … } // Returns pretty-printed segmentation of Text. // e.g. std::basic_string --> +-- +---- +----- std::string segment(llvm::StringRef Text) { … } // this is a no-op hack so clang-format will vertically align our testcases. std::string returns(llvm::StringRef Text) { … } TEST(FuzzyMatch, Segmentation) { … } } // namespace } // namespace clangd } // namespace clang