feat: add harder test-cases for sorted finders

This commit is contained in:
mandlm 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); auto result = finder.find_prefix(search_term);
find_timer.stop(); find_timer.stop();
cout << name << "(" << search_term << ") took " << find_timer << endl; cout << name << "(" << search_term << ") took " << find_timer << " for "
cout << "result list is " << std::distance(result.cbegin(), result.cend()) << std::distance(result.cbegin(), result.cend()) << " results" << endl;
<< " element(s) long" << endl;
} }
template <typename FINDER> template <typename FINDER>
@ -44,7 +43,8 @@ void test_finder(const WordList &word_list, string_view finder_name) {
constructor_timer.stop(); constructor_timer.stop();
cout << finder_name << " constructor took " << constructor_timer << endl; 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); test_finder_search(finder, finder_name, search_term);
} }
} }