Test string search for haystack/needle, up to len for each. If the length is -1, use the full string length. Searching in a substring allows checking whether the search respects the length stored in the StringValue or also reads parts of the string which should be excluded.
| 32 | // length stored in the StringValue or also reads parts of the string which |
| 33 | // should be excluded. |
| 34 | int TestSearch(const char* haystack, const char* needle, int haystack_len = -1, |
| 35 | int needle_len = -1) { |
| 36 | StringValue needle_str_val = StrValFromCString(needle, needle_len); |
| 37 | StringValue haystack_str_val = StrValFromCString(haystack, haystack_len); |
| 38 | StringSearch search(&needle_str_val); |
| 39 | return search.Search(&haystack_str_val); |
| 40 | } |
| 41 | |
| 42 | // Test reverse string search for haystack/needle, up to len for each. |
| 43 | // If the length is -1, use the full string length. |
no test coverage detected