2021: day01 tests

This commit is contained in:
Antoine Martin 2021-12-01 07:34:50 +01:00
parent 3e991d5ac1
commit 0667ca29ad
2 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,10 @@
199
200
208
210
200
207
240
269
260
263

View file

@ -43,3 +43,30 @@ fn part2(input: &str) -> Result<usize> {
Ok(increases)
}
#[cfg(test)]
mod tests {
use super::*;
const PROVIDED: &str = include_str!("../input/day01_provided.txt");
#[test]
fn part1_provided() {
assert_eq!(part1(PROVIDED).unwrap(), 7);
}
#[test]
fn part1_real() {
assert_eq!(part1(INPUT).unwrap(), 1502);
}
#[test]
fn part2_provided() {
assert_eq!(part2(PROVIDED).unwrap(), 5);
}
#[test]
fn part2_real() {
assert_eq!(part2(INPUT).unwrap(), 1538);
}
}