44 lines
988 B
Rust
44 lines
988 B
Rust
|
#[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)
|
||
|
);
|
||
|
}
|
||
|
}
|