feat: add harder test-cases for sorted finders

This commit is contained in:
Michael Mandl 2024-03-21 10:59:35 +01:00
parent 029196237d
commit 4b42f4c12a
Signed by: mandlm
GPG key ID: 4AA25D647AA54CC7

View file

@ -30,9 +30,8 @@ void test_finder_search(Finder &finder, string_view name,
auto result = finder.find_prefix(search_term);
find_timer.stop();
cout << name << "(" << search_term << ") took " << find_timer << endl;
cout << "result list is " << std::distance(result.cbegin(), result.cend())
<< " element(s) long" << endl;
cout << name << "(" << search_term << ") took " << find_timer << " for "
<< std::distance(result.cbegin(), result.cend()) << " results" << endl;
}
template <typename FINDER>
@ -44,7 +43,8 @@ void test_finder(const WordList &word_list, string_view finder_name) {
constructor_timer.stop();
cout << finder_name << " constructor took " << constructor_timer << endl;
for (const auto &search_term : {"A", "AB", "ABC", "ABCD"}) {
for (const auto &search_term :
{"A", "Z", "AB", "ZY", "ABC", "ZYX", "ABCD", "ZYXW"}) {
test_finder_search(finder, finder_name, search_term);
}
}