33 lines
719 B
Rust
33 lines
719 B
Rust
|
#[cfg(test)]
|
||
|
mod examples {
|
||
|
use day51::asteroid_collision;
|
||
|
|
||
|
#[test]
|
||
|
fn example1() {
|
||
|
let asteroids = &[5, 10, -5];
|
||
|
let res = asteroid_collision(asteroids);
|
||
|
assert_eq!(res, vec![5, 10]);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn example2() {
|
||
|
let asteroids = &[8, -8];
|
||
|
let res = asteroid_collision(asteroids);
|
||
|
assert_eq!(res, vec![]);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn example3() {
|
||
|
let asteroids = &[10, 2, -5];
|
||
|
let res = asteroid_collision(asteroids);
|
||
|
assert_eq!(res, vec![10]);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn example4() {
|
||
|
let asteroids = &[-2, -1, 1, 2];
|
||
|
let res = asteroid_collision(asteroids);
|
||
|
assert_eq!(res, vec![-2, -1, 1, 2]);
|
||
|
}
|
||
|
}
|