diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-21 03:26:51 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-21 03:30:10 -0500 |
commit | 56fe6c0b6bbfcd3bb370d14d77f5d1582db9a144 (patch) | |
tree | 0bd1be6eb8c7e50fdede2085a128e53c5c3b077b | |
parent | a8ebbcb0158ec63efd6e55a0f6335c8ed3362be4 (diff) | |
download | advent-of-code-56fe6c0b6bbfcd3bb370d14d77f5d1582db9a144.tar.gz advent-of-code-56fe6c0b6bbfcd3bb370d14d77f5d1582db9a144.zip |
tests
-rw-r--r-- | src/2021/20/mod.rs | 12 | ||||
-rw-r--r-- | src/2021/21/mod.rs | 12 |
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 + ); +} |