1
Fork 0
leetcode/tests/length_of_last_word.rs

11 lines
352 B
Rust

use leetcode::length_of_last_word::length_of_last_word;
use test_case::test_case;
#[test_case("hello to the world", 5; "simple")]
#[test_case(" fly me to the moon ", 4; "extra whitespace")]
#[test_case("", 0; "empty")]
fn test_length_of_last_word(input: &str, expected: i32) {
assert_eq!(length_of_last_word(input.to_string()), expected);
}