1
Fork 0
leetcode/tests/valid_number.rs

14 lines
404 B
Rust

use leetcode::valid_number::is_number;
use test_case::test_case;
#[test_case("0", true; "example 1")]
#[test_case("e", false; "example 2")]
#[test_case(".", false; "example 3")]
#[test_case("-inf", false; "infinity")]
#[test_case("NaN", false; "not a number")]
#[test_case("", false; "empty")]
fn test_valid_number(input: &str, expected: bool) {
assert_eq!(is_number(input.to_string()), expected);
}