| assert_eq("banana".find("na"), 2) |
| assert_eq("banana".find("na", 3, 1), -1) |
| assert_eq("aaaa".find("a", 1, 1), -1) |
| assert_eq("aaaa".find("a", 1, 50), 1) |
| assert_eq("aaaa".find("aaaaa"), -1) |
| assert_eq("abababa".find("ab", 1), 2) |
| assert_eq("abababa".find("ab", 0), 0) |
| assert_eq("abababa".find("ab", -1), -1) |
| assert_eq("abababa".find("ab", -2), -1) |
| assert_eq("abababa".find("ab", -3), 4) |
| assert_eq("abababa".find("ab", 0, 1), -1) |
| assert_eq("abababa".find("ab", 0, 2), 0) |
| assert_eq("abababa".find("ab", -1000), 0) |
| assert_eq("abababa".find("ab", 1000), -1) |
| assert_eq("".find("a", 1), -1) |
| |
| assert_eq("banana".rfind("na"), 4) |
| assert_eq("banana".rfind("na", 3, 1), -1) |
| assert_eq("aaaa".rfind("a", 1, 1), -1) |
| assert_eq("aaaa".rfind("a", 1, 50), 3) |
| assert_eq("aaaa".rfind("aaaaa"), -1) |
| assert_eq("abababa".rfind("ab", 1), 4) |
| assert_eq("abababa".rfind("ab", 0), 4) |
| assert_eq("abababa".rfind("ab", -1), -1) |
| assert_eq("abababa".rfind("ab", -2), -1) |
| assert_eq("abababa".rfind("ab", -3), 4) |
| assert_eq("abababa".rfind("ab", 0, 1), -1) |
| assert_eq("abababa".rfind("ab", 0, 2), 0) |
| assert_eq("abababa".rfind("ab", -1000), 4) |
| assert_eq("abababa".rfind("ab", 1000), -1) |
| assert_eq("".rfind("a", 1), -1) |