Test reverse 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.
| 45 | // length stored in the StringValue or also reads parts of the string which |
| 46 | // should be excluded. |
| 47 | int TestRSearch(const char* haystack, const char* needle, int haystack_len = -1, |
| 48 | int needle_len = -1) { |
| 49 | StringValue needle_str_val = StrValFromCString(needle, needle_len); |
| 50 | StringValue haystack_str_val = StrValFromCString(haystack, haystack_len); |
| 51 | StringSearch search(&needle_str_val); |
| 52 | return search.RSearch(&haystack_str_val); |
| 53 | } |
| 54 | |
| 55 | TEST(StringSearchTest, RegularSearch) { |
| 56 | // Basic Tests |
no test coverage detected