From dd58f60ef93b76640a6460acdcbe854539d9eb41 Mon Sep 17 00:00:00 2001 From: realstealthninja Date: Sun, 17 Nov 2024 04:11:29 +0000 Subject: [PATCH] Documentation for 769b3c71c1e10d5134f926435e012172d79d7166 --- d3/d80/z__function_8cpp.html | 28 +++++++++++++++++++------ d3/d80/z__function_8cpp_source.html | 32 +++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/d3/d80/z__function_8cpp.html b/d3/d80/z__function_8cpp.html index 9643faa52..f5ca6bd4a 100644 --- a/d3/d80/z__function_8cpp.html +++ b/d3/d80/z__function_8cpp.html @@ -231,11 +231,11 @@ Functions

Main function.

Returns
0 on exit
-

Definition at line 94 of file z_function.cpp.

-
94 {
-
95 test(); // run self-test implementations
-
96 return 0;
-
97}
+

Definition at line 110 of file z_function.cpp.

+
110 {
+
111 test(); // run self-test implementations
+
112 return 0;
+
113}
static void test()
Self-test implementations.
@@ -283,7 +283,23 @@ Functions
85 // matching_indexes2 gets the indexes where pattern2 exists in text2
86 std::vector<uint64_t> matching_indexes2 = find_pat_in_text(pattern2, text2);
87 assert((matching_indexes2 == std::vector<uint64_t>{}));
-
88}
+
88
+
89 // corner case - empty text
+
90 std::string text3 = "";
+
91 std::string pattern3 = "abc";
+
92
+
93 // matching_indexes3 gets the indexes where pattern3 exists in text3
+
94 std::vector<uint64_t> matching_indexes3 = find_pat_in_text(pattern3, text3);
+
95 assert((matching_indexes3 == std::vector<uint64_t>{}));
+
96
+
97 // corner case - empty pattern
+
98 std::string text4 = "redsand";
+
99 std::string pattern4 = "";
+
100
+
101 // matching_indexes4 gets the indexes where pattern4 exists in text4
+
102 std::vector<uint64_t> matching_indexes4 = find_pat_in_text(pattern4, text4);
+
103 assert((matching_indexes4 == std::vector<uint64_t>{0, 1, 2, 3, 4, 5, 6}));
+
104}
std::vector< uint64_t > find_pat_in_text(const std::string &pattern, const std::string &text)
Using Z_function to find a pattern in a text.
diff --git a/d3/d80/z__function_8cpp_source.html b/d3/d80/z__function_8cpp_source.html index 48071e7d8..3999676c5 100644 --- a/d3/d80/z__function_8cpp_source.html +++ b/d3/d80/z__function_8cpp_source.html @@ -189,19 +189,35 @@ $(function(){initNavTree('d3/d80/z__function_8cpp_source.html','../../'); initRe
85 // matching_indexes2 gets the indexes where pattern2 exists in text2
86 std::vector<uint64_t> matching_indexes2 = find_pat_in_text(pattern2, text2);
87 assert((matching_indexes2 == std::vector<uint64_t>{}));
-
88}
+
88
+
89 // corner case - empty text
+
90 std::string text3 = "";
+
91 std::string pattern3 = "abc";
+
92
+
93 // matching_indexes3 gets the indexes where pattern3 exists in text3
+
94 std::vector<uint64_t> matching_indexes3 = find_pat_in_text(pattern3, text3);
+
95 assert((matching_indexes3 == std::vector<uint64_t>{}));
+
96
+
97 // corner case - empty pattern
+
98 std::string text4 = "redsand";
+
99 std::string pattern4 = "";
+
100
+
101 // matching_indexes4 gets the indexes where pattern4 exists in text4
+
102 std::vector<uint64_t> matching_indexes4 = find_pat_in_text(pattern4, text4);
+
103 assert((matching_indexes4 == std::vector<uint64_t>{0, 1, 2, 3, 4, 5, 6}));
+
104}
-
89
-
-
94int main() {
-
95 test(); // run self-test implementations
-
96 return 0;
-
97}
+
105
+
+
110int main() {
+
111 test(); // run self-test implementations
+
112 return 0;
+
113}
static void test()
Self-test implementations.
std::vector< uint64_t > Z_function(const std::string &pattern)
for IO operations
std::vector< uint64_t > find_pat_in_text(const std::string &pattern, const std::string &text)
Using Z_function to find a pattern in a text.
-
int main()
Main function.
+
int main()
Main function.