use vyre::ops::string_matching::search_contract::NOT_FOUND;
use vyre::ops::string_matching::substring_find_first::substring_find_first;
#[test]
fn substring_find_first_returns_first_occurrence_offset() {
let haystack = b"hello world world";
let needle = b"world";
let result = substring_find_first(haystack, needle).expect("Inputs within T47 caps");
assert_eq!(result, 6);
}
#[test]
fn substring_find_first_returns_not_found_when_absent() {
let haystack = b"hello world";
let needle = b"foo";
let result = substring_find_first(haystack, needle).expect("Inputs within T47 caps");
assert_eq!(result, NOT_FOUND);
}
#[test]
fn substring_find_first_returns_zero_for_empty_needle() {
let haystack = b"hello world";
let needle = b"";
let result = substring_find_first(haystack, needle).expect("Inputs within T47 caps");
assert_eq!(result, 0);
}