100-days-of-rust/Week-07/Day-49_Swimming-Pool/day49/tests/examples.rs

44 lines
988 B
Rust
Raw Normal View History

2024-09-12 09:51:31 +00:00
#[cfg(test)]
mod examples {
use day49::is_legitimate;
#[test]
fn example1() {
assert_eq!(
is_legitimate(&[
vec![0, 0, 0, 0, 0, 0, 0, 0],
vec![0, 0, 1, 1, 1, 0, 0, 0],
vec![0, 1, 1, 1, 1, 1, 0, 0],
vec![0, 0, 0, 0, 0, 0, 0, 0]
]),
Some(true)
);
}
#[test]
fn example2() {
assert_eq!(
is_legitimate(&[
vec![0, 0, 0, 0, 0, 0, 0, 0],
vec![0, 0, 1, 1, 1, 0, 0, 0],
vec![0, 1, 1, 1, 1, 1, 0, 0],
vec![0, 0, 1, 1, 1, 0, 0, 0]
]),
Some(false)
);
}
#[test]
fn example3() {
assert_eq!(
is_legitimate(&[
vec![0, 0, 0, 0, 0],
vec![0, 1, 1, 1, 0],
vec![0, 1, 1, 1, 0],
vec![0, 0, 0, 0, 0]
]),
Some(true)
);
}
}