More comments added

This commit is contained in:
RitikaGupta8734 2021-09-02 22:14:27 +05:30 committed by GitHub
parent c9919d6605
commit 8a627ac9b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,7 +72,8 @@ static void test() {
// usual case // usual case
std::string text1 = "alskfjaldsabc1abc1abcbksbcdnsdabcabc"; std::string text1 = "alskfjaldsabc1abc1abcbksbcdnsdabcabc";
std::string pattern1 = "abc"; std::string pattern1 = "abc";
// matching_indexes1 gets the indexes where pattern1 exists in text1
std::vector<uint64_t> matching_indexes1 = find_pat_in_text(pattern1, text1); std::vector<uint64_t> matching_indexes1 = find_pat_in_text(pattern1, text1);
assert((matching_indexes1 == std::vector<uint64_t>{10, 14, 18, 30, 33})); assert((matching_indexes1 == std::vector<uint64_t>{10, 14, 18, 30, 33}));
@ -80,6 +81,7 @@ static void test() {
std::string text2 = "greengrass"; std::string text2 = "greengrass";
std::string pattern2 = "abc"; std::string pattern2 = "abc";
// matching_indexes2 gets the indexes where pattern2 exists in text2
std::vector<uint64_t> matching_indexes2 = find_pat_in_text(pattern2, text2); std::vector<uint64_t> matching_indexes2 = find_pat_in_text(pattern2, text2);
assert((matching_indexes2 == std::vector<uint64_t>{})); assert((matching_indexes2 == std::vector<uint64_t>{}));
} }