1
Fork 0
leetcode/tests/implement_strstr.rs

11 lines
350 B
Rust

use leetcode::implement_strstr::str_str;
use test_case::test_case;
#[test_case("hello", "ll", 2; "simple")]
#[test_case("aaaaa", "bba", -1; "not found")]
#[test_case("aaaaa", "", 0; "empty needle")]
fn test_implement_strstr(haystack: &str, needle: &str, expected: i32) {
assert_eq!(str_str(haystack.to_string(), needle.to_string()), expected);
}