From 757c109ac4ca3fcb1e8a83da8d54cb9203f29426 Mon Sep 17 00:00:00 2001 From: RitikaGupta8734 <43800283+RitikaGupta8734@users.noreply.github.com> Date: Wed, 1 Sep 2021 09:50:37 +0530 Subject: [PATCH] Apply suggestions from code review Some more documentation added as per contribution guidelines. Co-authored-by: David Leal --- strings/z_function.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/strings/z_function.cpp b/strings/z_function.cpp index b2ec48a7a..6e827e40e 100644 --- a/strings/z_function.cpp +++ b/strings/z_function.cpp @@ -21,7 +21,7 @@ #include /// for assert /** - * Generate the Z-function for the inputted string. + * @brief Generate the Z-function for the inputted string. * \param[in] pattern text on which to apply the Z-function * \returns the Z-function output as a vector array */ @@ -38,7 +38,7 @@ std::vector Z_function(const std::string &pattern) { } /** - * Using Z_function to find a pattern in a text + * @brief Using Z_function to find a pattern in a text * \param[in] pattern string pattern to search * \param[in] text text in which to search * \returns a vector of starting indexes where pattern is found in the text @@ -54,7 +54,11 @@ std::vector find_pat_in_text(const std::string &pattern, const std::string return matching_indexes; } -void testing(){ +/** + * @brief Self-test implementations + * @returns void + */ +static void test(){ // usual case std::string text1 = "alskfjaldsabc1abc1abcbksbcdnsdabcabc"; @@ -71,7 +75,10 @@ void testing(){ assert((matching_indexes2 == std::vector{})); } -/** Main function */ +/** + * @brief Main function + * @returns 0 on exit + */ int main() { testing();