15 lines
545 B
Rust
15 lines
545 B
Rust
use leetcode::first_missing_positive::first_missing_positive;
|
|
|
|
use test_case::test_case;
|
|
|
|
#[test_case(&[1, 2, 0], 3; "example 1")]
|
|
#[test_case(&[3, 4, -1, 1], 2; "example 2")]
|
|
#[test_case(&[7, 8, 9, 11, 12], 1; "example 3")]
|
|
#[test_case(&[1, 3, 2], 4; "maximum")]
|
|
#[test_case(&[1, 3, 3], 2; "duplicate")]
|
|
#[test_case(&[0], 1; "zero")]
|
|
#[test_case(&(0..=500000).into_iter().collect::<Vec<i32>>(), 500001; "massive")]
|
|
fn test_first_missing_positive(input: &[i32], expected: i32) {
|
|
assert_eq!(first_missing_positive(input.to_vec()), expected);
|
|
}
|