From db6d253e181a7323807bc211bba8812408655f25 Mon Sep 17 00:00:00 2001 From: anuran Date: Mon, 4 Oct 2021 03:14:46 +0530 Subject: [PATCH] Added a few more test cases and documentation --- search/text_search.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/search/text_search.cpp b/search/text_search.cpp index 0eaa152d8..b512ff82b 100644 --- a/search/text_search.cpp +++ b/search/text_search.cpp @@ -25,6 +25,11 @@ std::string lower(std::string word) { // convert a C++ string to lowercase return lc; } +/** + * @brief Self-test implementations + * @returns void + */ + void test() { assert(lower("abcd").compare("abcd") == 0); assert(lower("abc").compare("abcd") == -1); @@ -32,7 +37,7 @@ void test() { } int main() { - test(); // Testing the lower() function. + test(); // run self-test implementations std::string paragraph; std::cout << "Please enter your paragraph: \n"; std::getline(std::cin, paragraph);