MCPcopy Create free account
hub / github.com/comaps/comaps / MatchCostMock

Class MatchCostMock

libs/search/search_tests/string_match_test.cpp:20–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18using namespace strings;
19
20struct MatchCostMock
21{
22 uint32_t Cost10(char) const { return 1; }
23 uint32_t Cost01(char) const { return 1; }
24 uint32_t Cost11(char, char) const { return 1; }
25 uint32_t Cost12(char a, char const * pB) const
26 {
27 if (a == 'X' && pB[0] == '>' && pB[1] == '<')
28 return 0;
29 return 2;
30 }
31 uint32_t Cost21(char const * pA, char b) const { return Cost12(b, pA); }
32 uint32_t Cost22(char const *, char const *) const { return 2; }
33 uint32_t SwapCost(char, char) const { return 1; }
34};
35
36uint32_t FullMatchCost(char const * a, char const * b, uint32_t maxCost = 1000)
37{

Callers 2

FullMatchCostFunction · 0.85
PrefixMatchCostFunction · 0.85

Calls

no outgoing calls

Tested by 2

FullMatchCostFunction · 0.68
PrefixMatchCostFunction · 0.68