Apply suggestions from code review

Some more documentation added as per contribution guidelines.

Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
RitikaGupta8734 2021-09-01 09:50:37 +05:30 committed by GitHub
parent 9addf17de4
commit 757c109ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@
#include <cassert> /// 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<int> 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<int> 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<int>{}));
}
/** Main function */
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
testing();