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

Function UNIT_CLASS_TEST

libs/search/search_tests/bookmarks_processor_tests.cpp:96–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96UNIT_CLASS_TEST(BookmarksProcessorTest, Smoke)
97{
98 GetProcessor().EnableIndexingOfDescriptions(true);
99
100 Add(Id{10}, GroupId{0},
101 MakeBookmarkData("Double R Diner" /* name */, "2R Diner" /* customName */,
102 "They've got a cherry pie there that'll kill ya!" /* description */,
103 {"amenity-cafe"} /* types */));
104
105 Add(Id{18}, GroupId{0},
106 MakeBookmarkData("Silver Mustang Casino" /* name */, "Ag Mustang" /* customName */,
107 "Joyful place, owners Bradley and Rodney are very friendly!" /* description */,
108 {"amenity-casino"} /* types */));
109 Add(Id{20}, GroupId{1},
110 MakeBookmarkData("Great Northern Hotel" /* name */, "N Hotel" /* customName */,
111 "Clean place with a reasonable price" /* description */, {"tourism-hotel"} /* types */));
112
113 TEST_EQUAL(Search("R&R food"), Ids{}, ());
114 GetProcessor().EnableIndexingOfBookmarkGroup(GroupId{0}, true /* enable */);
115 TEST_EQUAL(Search("R&R food"), Ids({10}), ());
116 GetProcessor().EnableIndexingOfBookmarkGroup(GroupId{0}, false /* enable */);
117 TEST_EQUAL(Search("R&R food"), Ids{}, ());
118 GetProcessor().EnableIndexingOfBookmarkGroup(GroupId{0}, true /* enable */);
119 TEST_EQUAL(Search("R&R food"), Ids({10}), ());
120
121 GetProcessor().EnableIndexingOfBookmarkGroup(GroupId{1}, true /* enable */);
122
123 TEST_EQUAL(Search("cherry pie"), Ids({10}), ());
124 TEST_EQUAL(Search("great silver hotel"), Ids({20, 18}), ());
125 TEST_EQUAL(Search("double r cafe"), Ids({10}), ());
126 TEST_EQUAL(Search("dine"), Ids({10}), ());
127 TEST_EQUAL(Search("2R"), Ids({10}), ());
128 TEST_EQUAL(Search("Ag"), Ids({18}), ());
129
130 TEST_EQUAL(Search("place"), Ids({20, 18}), ());
131 TEST_EQUAL(Search("place", GroupId{0}), Ids({18}), ());
132 DetachFromGroup(Id{20}, GroupId{1});
133 AttachToGroup(Id{20}, GroupId{0});
134 TEST_EQUAL(Search("place", GroupId{0}), Ids({20, 18}), ());
135
136 Update(20, MakeBookmarkData("Great Northern Hotel" /* name */, "N Hotel" /* customName */,
137 "Clean establishment with a reasonable price" /* description */,
138 {"tourism-hotel"} /* types */));
139 TEST_EQUAL(Search("place", GroupId{0}), Ids({18}), ());
140
141 GetProcessor().Reset();
142 TEST_EQUAL(Search("place", GroupId{0}), Ids{}, ());
143}
144
145UNIT_CLASS_TEST(BookmarksProcessorTest, SearchByType)
146{

Callers

nothing calls this directly

Calls 7

MakeBookmarkDataFunction · 0.85
IdsClass · 0.85
AddFunction · 0.50
UpdateClass · 0.50
ResetMethod · 0.45

Tested by

no test coverage detected