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

Function UNIT_TEST

libs/search/search_tests/string_match_test.cpp:59–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59UNIT_TEST(StringMatchCost_FullMatch)
60{
61 TEST_EQUAL(FullMatchCost("", ""), 0, ());
62 TEST_EQUAL(FullMatchCost("a", "b"), 1, ());
63 TEST_EQUAL(FullMatchCost("a", ""), 1, ());
64 TEST_EQUAL(FullMatchCost("", "b"), 1, ());
65 TEST_EQUAL(FullMatchCost("ab", "cd"), 2, ());
66 TEST_EQUAL(FullMatchCost("ab", "ba"), 1, ());
67 TEST_EQUAL(FullMatchCost("abcd", "efgh"), 4, ());
68 TEST_EQUAL(FullMatchCost("Hello!", "Hello!"), 0, ());
69 TEST_EQUAL(FullMatchCost("Hello!", "Helo!"), 1, ());
70 TEST_EQUAL(FullMatchCost("X", "X"), 0, ());
71 TEST_EQUAL(FullMatchCost("X", "><"), 0, ());
72 TEST_EQUAL(FullMatchCost("XXX", "><><><"), 0, ());
73 TEST_EQUAL(FullMatchCost("XXX", "><X><"), 0, ());
74 TEST_EQUAL(FullMatchCost("TeXt", "Te><t"), 0, ());
75 TEST_EQUAL(FullMatchCost("TeXt", "Te><"), 1, ());
76 TEST_EQUAL(FullMatchCost("TeXt", "TetX"), 1, ());
77 TEST_EQUAL(FullMatchCost("TeXt", "Tet><"), 2, ());
78 TEST_EQUAL(FullMatchCost("", "ALongString"), 11, ());
79 TEST_EQUAL(FullMatchCost("x", "ALongString"), 11, ());
80 TEST_EQUAL(FullMatchCost("g", "ALongString"), 10, ());
81}
82
83UNIT_TEST(StringMatchCost_MaxCost)
84{

Callers

nothing calls this directly

Calls 4

FullMatchCostFunction · 0.85
PrefixMatchCostFunction · 0.85
TestEqualFunction · 0.70

Tested by

no test coverage detected