From c34fc7fefeeb93eb0e49d63a31c5b647fc4afb7d Mon Sep 17 00:00:00 2001 From: karsten Date: Fri, 17 Dec 2021 20:43:15 +0100 Subject: [PATCH] - removed dead code and added comment --- TestRunner.hpp | 1 + main.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/TestRunner.hpp b/TestRunner.hpp index ea5ec60..a1138c3 100644 --- a/TestRunner.hpp +++ b/TestRunner.hpp @@ -3,6 +3,7 @@ #include +// function template executing given function with one argument, measuring execution time template double TestRunner(Func func, Arg1& arg1) { diff --git a/main.cpp b/main.cpp index c85ce08..6a64ad9 100644 --- a/main.cpp +++ b/main.cpp @@ -41,8 +41,7 @@ bool check_result(const WordList& haystack, const std::string& pattern, const Pa // check number of matches const unsigned TESTPATTERN_LENGTH = 4; - unsigned expected_count = static_cast(pow(26.0, double(TESTPATTERN_LENGTH - pattern.size()))); - + unsigned expected_count = static_cast(pow(26.0, double(TESTPATTERN_LENGTH - pattern.size()))); if (result.size() != expected_count) { std::cout << "wrong number of matches: expected " << expected_count << " but got " << result.size() << std::endl; @@ -50,14 +49,9 @@ bool check_result(const WordList& haystack, const std::string& pattern, const Pa } // verify matches contain the search-pattern - unsigned valid_count = 0; for (WordList::const_iterator itr : result) { - if (itr->substr(0, pattern.size()) == pattern) - { - valid_count++; - } - else + if (itr->substr(0, pattern.size()) != pattern) { std::cout << "found unexpected entry in result: " << *itr << std::endl; result_valid = false;