summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/2021/20/mod.rs12
-rw-r--r--src/2021/21/mod.rs12
2 files changed, 24 insertions, 0 deletions
diff --git a/src/2021/20/mod.rs b/src/2021/20/mod.rs
index a46acab..2905880 100644
--- a/src/2021/20/mod.rs
+++ b/src/2021/20/mod.rs
@@ -94,3 +94,15 @@ pub fn part2(mut image: Image) -> anyhow::Result<i64> {
}
Ok(image.count_true())
}
+
+#[test]
+fn test() {
+ assert_eq!(
+ part1(parse(crate::util::data(2021, 20).unwrap()).unwrap()).unwrap(),
+ 5306
+ );
+ assert_eq!(
+ part2(parse(crate::util::data(2021, 20).unwrap()).unwrap()).unwrap(),
+ 17497
+ );
+}
diff --git a/src/2021/21/mod.rs b/src/2021/21/mod.rs
index b8c6be9..beff797 100644
--- a/src/2021/21/mod.rs
+++ b/src/2021/21/mod.rs
@@ -199,3 +199,15 @@ pub fn part2(game: Game) -> anyhow::Result<i64> {
let (p1, p2) = game.run_dirac(true);
Ok(p1.max(p2))
}
+
+#[test]
+fn test() {
+ assert_eq!(
+ part1(parse(crate::util::data(2021, 21).unwrap()).unwrap()).unwrap(),
+ 1004670
+ );
+ assert_eq!(
+ part2(parse(crate::util::data(2021, 21).unwrap()).unwrap()).unwrap(),
+ 492043106122795
+ );
+}