12 lines
426 B
Rust
12 lines
426 B
Rust
|
use leetcode::valid_anagram::is_anagram;
|
||
|
|
||
|
use test_case::test_case;
|
||
|
|
||
|
#[test_case("anagram", "nagaram", true; "simple")]
|
||
|
#[test_case("💖🌠banana", "an💖anab🌠", true; "unicode")]
|
||
|
#[test_case("rat", "cat", false; "invalid")]
|
||
|
#[test_case("bats", "bat", false; "invalid because inequal length")]
|
||
|
fn test_valid_anagram(a: &str, b: &str, expected: bool) {
|
||
|
assert_eq!(is_anagram(a.to_string(), b.to_string()), expected);
|
||
|
}
|