From 0e4c121ebdb3f6687148a550587c54ad61287d1f Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 6 Dec 2021 11:24:54 +0100 Subject: [PATCH] 2021: day06: tests --- aoc2021/input/day06_provided.txt | 1 + aoc2021/src/day06.rs | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 aoc2021/input/day06_provided.txt diff --git a/aoc2021/input/day06_provided.txt b/aoc2021/input/day06_provided.txt new file mode 100644 index 0000000..55129f1 --- /dev/null +++ b/aoc2021/input/day06_provided.txt @@ -0,0 +1 @@ +3,4,3,1,2 diff --git a/aoc2021/src/day06.rs b/aoc2021/src/day06.rs index 876252c..f0b6ec4 100644 --- a/aoc2021/src/day06.rs +++ b/aoc2021/src/day06.rs @@ -123,4 +123,28 @@ impl std::str::FromStr for LanternFish { } #[cfg(test)] -mod tests {} +mod tests { + use super::*; + + const PROVIDED: &str = include_str!("../input/day06_provided.txt"); + + #[test] + fn part1_provided() { + assert_eq!(part1(PROVIDED).unwrap(), 5934); + } + + #[test] + fn part1_real() { + assert_eq!(part1(INPUT).unwrap(), 350149); + } + + #[test] + fn part2_provided() { + assert_eq!(part2(PROVIDED).unwrap(), 26984457539); + } + + #[test] + fn part2_real() { + assert_eq!(part2(INPUT).unwrap(), 1590327954513); + } +}