diff --git a/CHANGELOG.md b/CHANGELOG.md
index 827a303..ab05992 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,12 @@ Of note:
- The changelog 2015.5.2 has been rewritten from each commit content.
- This file may be amended entirely in the future to adhere to the [GNU Changelog style](https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html#Style-of-Change-Logs)
+## [2015.20.2]
+### Added
+- More documentation.
+### Changed
+- Moved all tests into a proper place.
+
## [2015.20.1]
### Added
- Solved [exercice for 2015, day 20](src/year_2015/day_20.rs).
diff --git a/Cargo.toml b/Cargo.toml
index 571a490..1af7517 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "advent-rs"
-version = "2015.20.1"
+version = "2015.20.2"
edition = "2021"
authors = ["Arnaud 'red' Rouyer"]
readme = "README.md"
@@ -12,6 +12,7 @@ name = "advent-rs"
path = "src/main.rs"
doc = false
doctest = false
+test = false
[lib]
name = "advent_rs"
diff --git a/NOTES_2015.md b/NOTES_2015.md
index 5180aa3..8aeda80 100644
--- a/NOTES_2015.md
+++ b/NOTES_2015.md
@@ -7,7 +7,7 @@
```
test year_2015::day_01::tests::works_with_samples_v1 ... ok
test year_2015::day_01::tests::works_with_samples_v2 ... ok
-test year_2015_day_01 ... ok
+test year_2015::tests::day_01 ... ok
year_2015::day_01/year_2015::day_01_v1
time: [6.2931 µs 6.8094 µs 7.3834 µs]
@@ -42,7 +42,7 @@ There is an EVEN BIGGER optimization that can be done if you treat your string a
```
test year_2015::day_02::tests::works_with_samples_v1 ... ok
test year_2015::day_02::tests::works_with_samples_v2 ... ok
-test year_2015_day_02 ... ok
+test year_2015::tests::day_02 ... ok
year_2015::day_02/year_2015::day_02_v1
time: [74.835 µs 74.904 µs 74.977 µs]
@@ -72,7 +72,7 @@ The most annoying part here is dealing with many integers size. Clearly everythi
test year_2015::day_03::tests::moves_characters_properly ... ok
test year_2015::day_03::tests::works_with_samples_v1 ... ok
test year_2015::day_03::tests::works_with_samples_v2 ... ok
-test year_2015_day_03 ... ok
+test year_2015::tests::day_03 ... ok
year_2015::day_03/year_2015::day_03_v1
time: [232.27 µs 232.77 µs 233.35 µs]
@@ -109,7 +109,7 @@ This time, [the benchmark](benches/year_2015_day_03.rs) checks which of [`BTreeS
```
test year_2015::day_04::tests::works_with_samples_v1 ... ok
test year_2015::day_04::tests::works_with_samples_v2 ... ok
-test year_2015_day_04 ... ok
+test year_2015::tests::day_04 ... ok
year_2015::day_04/year_2015::day_04_v1
time: [36.404 ms 36.439 ms 36.457 ms]
@@ -137,7 +137,7 @@ test year_2015::day_05::tests::finds_nice_strings_v1 ... ok
test year_2015::day_05::tests::finds_nice_strings_v2 ... ok
test year_2015::day_05::tests::works_with_samples_v1 ... ok
test year_2015::day_05::tests::works_with_samples_v2 ... ok
-test year_2015_day_05 ... ok
+test year_2015::tests::day_05 ... ok
year_2015::day_05/year_2015::day_05_v1
time: [51.142 µs 51.447 µs 51.928 µs]
@@ -168,7 +168,7 @@ Another [benchmark](benches/year_2015_day_05.rs), and again it's about the perfo
```
test year_2015::day_06::tests::works_with_samples_v1 ... ok
test year_2015::day_06::tests::works_with_samples_v2 ... ok
-test year_2015_day_06 ... ok
+test year_2015::tests::day_06 ... ok
year_2015::day_06/year_2015::day_06_v1
time: [13.186 ms 13.320 ms 13.522 ms]
@@ -201,7 +201,7 @@ I started doing a copy of my original "naive" algorithm, and as it was too slow,
```
test year_2015::day_07::tests::works_with_samples_v1 ... ok
test year_2015::day_07::tests::works_with_samples_v2 ... ok
-test year_2015_day_07 ... ok
+test year_2015::tests::day_07 ... ok
year_2015::day_07/year_2015::day_07_v1
time: [62.800 µs 62.873 µs 62.940 µs]
@@ -259,7 +259,7 @@ This one was actually very funny. For a while, I thought it would be a pain to n
```
test year_2015::day_09::tests::works_with_samples_v1 ... ok
test year_2015::day_09::tests::works_with_samples_v2 ... ok
-test year_2015_day_09 ... ok
+test year_2015::tests::day_09 ... ok
year_2015::day_09/year_2015::day_09_v1
time: [1.2927 ms 1.2995 ms 1.3064 ms]
@@ -291,7 +291,7 @@ While my [more experienced counterpart](https://docs.rs/advent-of-code/2022.0.66
```
test year_2015::day_10::tests::looks_and_says_over_strings ... ok
-test year_2015_day_10 ... ok
+test year_2015::tests::day_10 ... ok
year_2015::day_10/year_2015::day_10_v1
time: [870.36 µs 872.61 µs 875.35 µs]
@@ -318,7 +318,7 @@ Casting between string, chars, bytes,... is slowly becoming more and more natura
```
test year_2015::day_11::tests::passwords_are_valid ... ok
test year_2015::day_11::tests::works_with_samples_v1 ... ok
-test year_2015_day_11 ... ok
+test year_2015::tests::day_11 ... ok
year_2015::day_11/year_2015::day_11_v1
time: [4.8713 ms 4.8800 ms 4.8927 ms]
@@ -345,7 +345,7 @@ Nothing specific to add on this one. I'm just missing the optimization
```
test year_2015::day_12::tests::works_with_samples_v1 ... ok
test year_2015::day_12::tests::works_with_samples_v2 ... ok
-test year_2015_day_12 ... ok
+test year_2015::tests::day_12 ... ok
year_2015::day_12/year_2015::day_12_v1
time: [17.760 µs 17.955 µs 18.183 µs]
@@ -373,7 +373,7 @@ You know what's faster than using a Regex matcher on a string, or converting it
```
test year_2015::day_13::tests::parses_input_lines ... ok
test year_2015::day_13::tests::works_with_samples_v1 ... ok
-test year_2015_day_13 ... ok
+test year_2015::tests::day_13 ... ok
year_2015::day_13/year_2015::day_13_v1
time: [46.791 ms 47.177 ms 47.561 ms]
@@ -404,7 +404,7 @@ Something I also gained over my Ruby implementation is saving a loop: since we a
```
test year_2015::day_14::tests::works_with_samples_v1 ... ok
test year_2015::day_14::tests::works_with_samples_v2 ... ok
-test year_2015_day_14 ... ok
+test year_2015::tests::day_14 ... ok
year_2015::day_14/year_2015::day_14_v1
time: [3.5302 ms 3.5346 ms 3.5403 ms]
@@ -430,7 +430,7 @@ Nothing too different here.
```
test year_2015::day_15::tests::works_with_samples_v1 ... ok
test year_2015::day_15::tests::works_with_samples_v2 ... ok
-test year_2015_day_15 ... ok
+test year_2015::tests::day_15 ... ok
year_2015::day_15/year_2015::day_15_v1
time: [35.365 ms 35.613 ms 35.944 ms]
@@ -459,7 +459,7 @@ After trying many times to use my previous algorithm to mark ranges where number
📊Tests and benchmarks
```
-test year_2015_day_16 ... ok
+test year_2015::tests::day_16 ... ok
year_2015::day_16/year_2015::day_16_v1
time: [115.32 µs 115.43 µs 115.53 µs]
@@ -484,7 +484,7 @@ This one was already easy in Ruby, and it's just as easy in Rust.
```
test year_2015::day_17::tests::works_with_samples_v1 ... ok
test year_2015::day_17::tests::works_with_samples_v2 ... ok
-test year_2015_day_17 ... ok
+test year_2015::tests::day_17 ... ok
year_2015::day_17/year_2015::day_17_v1
time: [9.3768 ms 9.3931 ms 9.4143 ms]
@@ -510,7 +510,7 @@ Heh, I'm getting to used to this stuff that it compiled on the second try, and p
```
test year_2015::day_18::tests::works_with_samples_v1 ... ok
test year_2015::day_18::tests::works_with_samples_v2 ... ok
-test year_2015_day_18 ... ok
+test year_2015::tests::day_18 ... ok
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.4s, or reduce sample count to 90.
year_2015::day_18/year_2015::day_18_v1
@@ -542,7 +542,7 @@ My [distinguished competitor](https://docs.rs/advent-of-code/2022.0.66/src/adven
```
test year_2015::day_19::tests::works_with_samples_v1 ... ok
test year_2015::day_19::tests::works_with_samples_v2 ... ok
-test year_2015_day_19 ... ok
+test year_2015::tests::day_19 ... ok
year_2015::day_19/year_2015::day_19_v1
time: [565.05 µs 565.71 µs 566.40 µs]
@@ -566,7 +566,7 @@ Okay, that was less painful than I remembered it, and my Rust code is actually c
```
test year_2015::day_20::tests::works_with_samples_v1 ... ok
-test year_2015_day_20 ... ok
+test year_2015::tests::day_20 ... ok
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 45.9s, or reduce sample count to 10.
year_2015::day_20/year_2015::day_20_v1
diff --git a/README.md b/README.md
index 30d903e..c30d897 100644
--- a/README.md
+++ b/README.md
@@ -4,10 +4,8 @@
As I said, [Consistency is hard](https://github.com/joshleaves/advent-rb), and I haven't taken the time to pick up a new language in quite a while.
-I'm also adding notes that may be useful if you're discovering Rust (like I am).
-
-Notes for solving:
-* [2015, up to day 20](NOTES_2015.md)
+I'm also adding notes that may be useful if you're (like me) discovering Rust:
+- [2015, up to day 20](NOTES_2015.md)
# Regarding style rules
I'm gonna use a mix of what `cargo fmt` does, with some stuff that feels more natural to me.
@@ -19,3 +17,6 @@ Strangely, testing feels more natural in Rust than in Ruby. Since I've [already
I use [criterion.rs](https://github.com/bheisler/criterion.rs) for benchmarking, as it feels like the best option. I try to strive for the most effective solutions, without cutting corners. I could probably gain a lot more time in some spaces, but I'm going at my own speed for now.
The speeds I'm reporting are what my Mac M2 reports, depending on how many Chrome tabs I got opened. It's just to give myself a pat on the back.
+
+# Documentation
+I am playing with [RustDoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) and am trying a few things. Maybe all sample tests will be moved into [documentation tests](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html), which I think is a very neat feature.
diff --git a/src/lib.rs b/src/lib.rs
index dc1d274..34e7e28 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,6 +4,7 @@ use std::path::PathBuf;
macro_rules! solvable {
($day_xx:tt, $day_v1:tt, $day_v2:tt, $retype:ty) => {
+ /// Stub function calling the _v1 or _v2 variant
pub fn $day_xx(part: u8, input: impl Into) -> $retype {
match part {
1 => $day_v1(input),
@@ -18,6 +19,7 @@ macro_rules! solvable {
pub mod year_2015;
+/// Turns a file into a String input
pub fn fetch_input_from_file(filename: PathBuf) -> Result {
match fs::read_to_string(filename) {
Ok(file_data) => Ok(file_data),
@@ -25,6 +27,7 @@ pub fn fetch_input_from_file(filename: PathBuf) -> Result Result {
match io::read_to_string(io::stdin()) {
@@ -79,6 +82,14 @@ pub fn solve(year: u16, day: u8, part: u8, input: impl Into) -> Option = Some("foo.txt".into());
+ let error = fetch_input(path.clone()).unwrap_err();
+ assert_eq!(error.kind(), ErrorKind::NotFound);
+ }
#[test]
fn solve_for_invalid_year() {
diff --git a/src/main.rs b/src/main.rs
index 28a0a61..1ba580d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -43,16 +43,3 @@ fn main() {
}
};
}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use std::io::ErrorKind;
-
- #[test]
- fn fetch_input_from_inexisting_file() {
- let path: Option = Some("foo.txt".into());
- let error = advent_rs::fetch_input(path.clone()).unwrap_err();
- assert_eq!(error.kind(), ErrorKind::NotFound);
- }
-}
diff --git a/src/year_2015.rs b/src/year_2015.rs
index 3a90bbb..098f2c7 100644
--- a/src/year_2015.rs
+++ b/src/year_2015.rs
@@ -1,3 +1,38 @@
+//! Year 2015
+//!
+//! ```text
+//! |
+//! \|/
+//! --*-- 25 **
+//! >o< 24 **
+//! >>@<< 23 **
+//! >>o>*<< 22 **
+//! >@<<@< 21 **
+//! >@<<<*<<>o<<o<@<@<>@< 18 **
+//! >>O>>o>>O>*>>@<<< 17 **
+//! >O>*>o>>O>o<<< 16 **
+//! >>o<<<@>*<*<<*<@<< 15 **
+//! >>o>O<<*>*>>>o>*<<<*<<< 14 **
+//! >o>O<<<*<<*>O>*>@>o<<*<@>>>O<<<@<<<< 12 **
+//! >>O<@<>>o>>>@<<@>o>>>O< 11 **
+//! >*>>>*<>>o>>@<<@<<@<@>@<< 10 **
+//! >@>>>@<@>>>o<@<<<@>@>@>>O>>@<< 9 **
+//! >>@<<o<<<@<o<<>*<<*< 8 **
+//! >O<<*>>>O>>@<O<*<<<*<< 7 **
+//! >>@>>>o>>>o<*O<<@>>@<< 6 **
+//! >>*>O<<<@<@>>>*>>o<@>*<>O>O<o< 5 **
+//! >>O>>*<<@<<>>*>>O>>o>*>@>>>o<<*<<>@<*<<>@<<<*>>>*<<< 3 **
+//! >>O<>>O>>>@>@<>o>>>o>@>>o<<<@>>O@>>>@>>o>>@>@>>>O>o>o>>>*<<<@>@<<<*>@>o<<>O<< 1 **
+//! | |
+//! | |
+//! _ _ __ ___|___|___ __ _ _
+//! ```
+//!
pub mod day_01;
pub mod day_02;
pub mod day_03;
@@ -47,26 +82,170 @@ pub fn solve(day: u8, part: u8, input: impl Into) -> Option {
return None;
}
match day {
- 1 => return Some(format!("{}", day_01::day_01(part, input))),
- 2 => return Some(format!("{}", day_02::day_02(part, input))),
- 3 => return Some(format!("{}", day_03::day_03(part, input))),
- 4 => return Some(format!("{}", day_04::day_04(part, input))),
- 5 => return Some(format!("{}", day_05::day_05(part, input))),
- 6 => return Some(format!("{}", day_06::day_06(part, input))),
- 7 => return Some(format!("{}", day_07::day_07(part, input))),
- 8 => return Some(format!("{}", day_08::day_08(part, input))),
- 9 => return Some(format!("{}", day_09::day_09(part, input))),
- 10 => return Some(format!("{}", day_10::day_10(part, input))),
- 11 => return Some(format!("{}", day_11::day_11(part, input))),
- 12 => return Some(format!("{}", day_12::day_12(part, input))),
- 13 => return Some(format!("{}", day_13::day_13(part, input))),
- 14 => return Some(format!("{}", day_14::day_14(part, input))),
- 15 => return Some(format!("{}", day_15::day_15(part, input))),
- 16 => return Some(format!("{}", day_16::day_16(part, input))),
- 17 => return Some(format!("{}", day_17::day_17(part, input))),
- 18 => return Some(format!("{}", day_18::day_18(part, input))),
- 19 => return Some(format!("{}", day_19::day_19(part, input))),
- 20 => return Some(format!("{}", day_20::day_20(part, input))),
- _ => return None,
+ 1 => Some(format!("{}", day_01::day_01(part, input))),
+ 2 => Some(format!("{}", day_02::day_02(part, input))),
+ 3 => Some(format!("{}", day_03::day_03(part, input))),
+ 4 => Some(format!("{}", day_04::day_04(part, input))),
+ 5 => Some(format!("{}", day_05::day_05(part, input))),
+ 6 => Some(format!("{}", day_06::day_06(part, input))),
+ 7 => Some(format!("{}", day_07::day_07(part, input))),
+ 8 => Some(format!("{}", day_08::day_08(part, input))),
+ 9 => Some(format!("{}", day_09::day_09(part, input))),
+ 10 => Some(format!("{}", day_10::day_10(part, input))),
+ 11 => Some(format!("{}", day_11::day_11(part, input))),
+ 12 => Some(format!("{}", day_12::day_12(part, input))),
+ 13 => Some(format!("{}", day_13::day_13(part, input))),
+ 14 => Some(format!("{}", day_14::day_14(part, input))),
+ 15 => Some(format!("{}", day_15::day_15(part, input))),
+ 16 => Some(format!("{}", day_16::day_16(part, input))),
+ 17 => Some(format!("{}", day_17::day_17(part, input))),
+ 18 => Some(format!("{}", day_18::day_18(part, input))),
+ 19 => Some(format!("{}", day_19::day_19(part, input))),
+ 20 => Some(format!("{}", day_20::day_20(part, input))),
+ _ => None,
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn day_01() {
+ let input = include_str!("../inputs/year_2015_day_01_input");
+ assert_eq!(day_01::day_01_v1(input), 138);
+ assert_eq!(day_01::day_01_v2(input), 1771);
+ }
+
+ #[test]
+ fn day_02() {
+ let input = include_str!("../inputs/year_2015_day_02_input");
+ assert_eq!(day_02::day_02_v1(input), 1_588_178);
+ assert_eq!(day_02::day_02_v2(input), 3_783_758);
+ }
+
+ #[test]
+ fn day_03() {
+ let input = include_str!("../inputs/year_2015_day_03_input");
+ assert_eq!(day_03::day_03_v1(input), 2081);
+ assert_eq!(day_03::day_03_v2(input), 2341);
+ }
+
+ #[test]
+ fn day_04() {
+ let input = include_str!("../inputs/year_2015_day_04_input");
+ assert_eq!(day_04::day_04_v1(input), 346_386);
+ assert_eq!(day_04::day_04_v2(input), 9_958_218);
+ }
+
+ #[test]
+ fn day_05() {
+ let input = include_str!("../inputs/year_2015_day_05_input");
+ assert_eq!(day_05::day_05_v1(input), 238);
+ assert_eq!(day_05::day_05_v2(input), 69);
+ }
+
+ #[test]
+ fn day_06() {
+ let input = include_str!("../inputs/year_2015_day_06_input");
+ assert_eq!(day_06::day_06_v1(input), 400_410);
+ assert_eq!(day_06::day_06_v2(input), 15_343_601);
+ }
+
+ #[test]
+ fn day_07() {
+ let input = include_str!("../inputs/year_2015_day_07_input");
+ assert_eq!(day_07::day_07_v1(input), 46_065);
+ assert_eq!(day_07::day_07_v2(input), 14_134);
+ }
+
+ #[test]
+ fn day_08() {
+ let input = include_str!("../inputs/year_2015_day_08_input");
+ assert_eq!(day_08::day_08_v1(input), 1_333);
+ assert_eq!(day_08::day_08_v2(input), 2_046);
+ }
+
+ #[test]
+ fn day_09() {
+ let input = include_str!("../inputs/year_2015_day_09_input");
+ assert_eq!(day_09::day_09_v1(input), 117);
+ assert_eq!(day_09::day_09_v2(input), 909);
+ }
+ #[test]
+ fn day_10() {
+ let input = include_str!("../inputs/year_2015_day_10_input");
+ assert_eq!(day_10::day_10_v1(input), 252_594);
+ assert_eq!(day_10::day_10_v2(input), 3_579_328);
+ }
+
+ #[test]
+ fn day_11() {
+ let input = include_str!("../inputs/year_2015_day_11_input");
+ assert_eq!(day_11::day_11_v1(input), "vzbxxyzz");
+ assert_eq!(day_11::day_11_v2(input), "vzcaabcc");
+ }
+
+ #[test]
+ fn day_12() {
+ let input = include_str!("../inputs/year_2015_day_12_input");
+ assert_eq!(day_12::day_12_v1(input), 111_754);
+ assert_eq!(day_12::day_12_v2(input), 65_402);
+ }
+
+ #[test]
+ fn day_13() {
+ let input = include_str!("../inputs/year_2015_day_13_input");
+ assert_eq!(day_13::day_13_v1(input), 709);
+ assert_eq!(day_13::day_13_v2(input), 668);
+ }
+
+ #[test]
+ fn day_14() {
+ let input = include_str!("../inputs/year_2015_day_14_input");
+ assert_eq!(day_14::day_14_v1(input), 2655);
+ assert_eq!(day_14::day_14_v2(input), 1059);
+ }
+
+ #[test]
+ fn day_15() {
+ let input = include_str!("../inputs/year_2015_day_15_input");
+ assert_eq!(day_15::day_15_v1(input), 222_870);
+ assert_eq!(day_15::day_15_v2(input), 117_936);
+ }
+
+ #[test]
+ fn day_16() {
+ let input = include_str!("../inputs/year_2015_day_16_input");
+ assert_eq!(day_16::day_16_v1(input), 373);
+ assert_eq!(day_16::day_16_v2(input), 260);
+ }
+
+ #[test]
+ fn day_17() {
+ let input = include_str!("../inputs/year_2015_day_17_input");
+ assert_eq!(day_17::day_17_v1(input), 1638);
+ assert_eq!(day_17::day_17_v2(input), 17);
+ }
+
+ #[test]
+ fn day_18() {
+ let input = include_str!("../inputs/year_2015_day_18_input");
+ assert_eq!(day_18::day_18_v1(input), 821);
+ assert_eq!(day_18::day_18_v2(input), 886);
+ }
+
+ #[test]
+ fn day_19() {
+ let input = include_str!("../inputs/year_2015_day_19_input");
+ assert_eq!(day_19::day_19_v1(input), 576);
+ assert_eq!(day_19::day_19_v2(input), 207);
+ }
+
+ #[test]
+ fn day_20() {
+ let input = include_str!("../inputs/year_2015_day_20_input");
+ assert_eq!(day_20::day_20_v1(input), 831_600);
+ assert_eq!(day_20::day_20_v2(input), 884_520);
}
}
diff --git a/src/year_2015/day_01.rs b/src/year_2015/day_01.rs
index 076935c..a5b49a8 100644
--- a/src/year_2015/day_01.rs
+++ b/src/year_2015/day_01.rs
@@ -37,6 +37,7 @@
//! > What is the position of the character that causes Santa to first enter the basement?
//! >
//! > Your puzzle answer was ~~`REDACTED`~~.
+//!
/// Solve exercise for year 2015, day 1 (part 1).
///
@@ -72,24 +73,19 @@
/// Note: Further optimization CAN be done by treating the string as `Vec`,
/// but the matcher would become too complicated to maintain.
///
-/// # Examples
+/// # Samples
/// ```
/// use advent_rs::year_2015::day_01;
///
-/// assert_eq!(day_01::day_01_v1("("), 1);
-/// assert_eq!(day_01::day_01_v1(")"), -1);
-/// assert_eq!(day_01::day_01_v1("(("), 2);
-/// assert_eq!(day_01::day_01_v1("))"), -2);
-/// assert_eq!(day_01::day_01_v1("()"), 0);
-/// assert_eq!(day_01::day_01_v1(")("), 0);
-///
-/// let input_a = "))(((((";
-/// let solution_a = day_01::day_01_v1(input_a);
-/// assert_eq!(solution_a, 3);
-///
-/// let input_b = ")())())";
-/// let solution_b = day_01::day_01_v1(input_b);
-/// assert_eq!(solution_b, -3);
+/// assert_eq!(day_01::day_01_v1("(())"), 0);
+/// assert_eq!(day_01::day_01_v1("()()"), 0);
+/// assert_eq!(day_01::day_01_v1("((("), 3);
+/// assert_eq!(day_01::day_01_v1("(()(()("), 3);
+/// assert_eq!(day_01::day_01_v1("))((((("), 3);
+/// assert_eq!(day_01::day_01_v1("())"), -1);
+/// assert_eq!(day_01::day_01_v1("))("), -1);
+/// assert_eq!(day_01::day_01_v1(")))"), -3);
+/// assert_eq!(day_01::day_01_v1(")())())"), -3);
/// ```
pub fn day_01_v1(input: impl Into) -> i16 {
let mut lvl: i16 = 0;
@@ -129,20 +125,13 @@ pub fn day_01_v1(input: impl Into) -> i16 {
/// Advantage: Impossible to use the "Naive" implementation, and "Normal" is not
/// a huge time loss either.
///
-/// # Examples:
+/// # Samples
/// ```
/// use advent_rs::year_2015::day_01;
///
-/// assert_eq!(day_01::day_01_v2("("), 0);
+/// assert_eq!(day_01::day_01_v2("(())"), 0);
/// assert_eq!(day_01::day_01_v2(")"), 1);
-/// assert_eq!(day_01::day_01_v2("(("), 0);
-/// assert_eq!(day_01::day_01_v2("))"), 1);
-/// assert_eq!(day_01::day_01_v2("()"), 0);
-/// assert_eq!(day_01::day_01_v2(")("), 1);
-///
-/// let input = "()())";
-/// let solution = day_01::day_01_v2(input);
-/// assert_eq!(solution, 5);
+/// assert_eq!(day_01::day_01_v2("()())"), 5);
/// ```
pub fn day_01_v2(input: impl Into) -> i16 {
let mut lvl: i16 = 0;
diff --git a/src/year_2015/day_02.rs b/src/year_2015/day_02.rs
index 097509c..118d55f 100644
--- a/src/year_2015/day_02.rs
+++ b/src/year_2015/day_02.rs
@@ -1,3 +1,35 @@
+//! Advent of Code 2015: Day 2: I Was Told There Would Be No Math
+//!
+//! # Original exercise:
+//! > ## --- Day 2: I Was Told There Would Be No Math ---
+//! > The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length l, width w, and height h) of each present, and only want to order exactly as much as they need.
+//! >
+//! > Fortunately, every present is a box (a perfect right rectangular prism), which makes calculating the required wrapping paper for each gift a little easier: find the surface area of the box, which is `2*l*w + 2*w*h + 2*h*l`. The elves also need a little extra paper for each present: the area of the smallest side.
+//! >
+//! > For example:
+//! >
+//! > - A present with dimensions `2x3x4` requires `2*6 + 2*12 + 2*8 = 52` square feet of wrapping paper plus `6` square feet of slack, for a total of `58` square feet.
+//! > - A present with dimensions `1x1x10` requires `2*1 + 2*10 + 2*10 = 42` square feet of wrapping paper plus `1` square foot of slack, for a total of `43` square feet.
+//! >
+//! > All numbers in the elves' list are in feet. How many total square feet of wrapping paper should they order?
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+//! >
+//! > ## --- Part Two ---
+//! > The elves are also running low on ribbon. Ribbon is all the same width, so they only have to worry about the length they need to order, which they would again like to be exact.
+//! >
+//! > The ribbon required to wrap a present is the shortest distance around its sides, or the smallest perimeter of any one face. Each present also requires a bow made out of ribbon as well; the feet of ribbon required for the perfect bow is equal to the cubic feet of volume of the present. Don't ask how they tie the bow, though; they'll never tell.
+//! >
+//! > For example:
+//! >
+//! > - A present with dimensions `2x3x4` requires `2+2+3+3 = 10` feet of ribbon to wrap the present plus `2*3*4 = 24` feet of ribbon for the bow, for a total of `34` feet.
+//! > - A present with dimensions `1x1x10` requires `1+1+1+1 = 4` feet of ribbon to wrap the present plus `1*1*10 = 10` feet of ribbon for the bow, for a total of `14` feet.
+//! >
+//! > How many total feet of ribbon should they order?
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+//!
+
use std::str::FromStr;
#[derive(Debug, PartialEq)]
diff --git a/src/year_2015/day_03.rs b/src/year_2015/day_03.rs
index 584bc2f..8b80540 100644
--- a/src/year_2015/day_03.rs
+++ b/src/year_2015/day_03.rs
@@ -1,6 +1,39 @@
+//! Advent of Code 2015: Day 3: Perfectly Spherical Houses in a Vacuum
+//!
+//! # Original exercise:
+//! > ## --- Day 3: Perfectly Spherical Houses in a Vacuum ---
+//! > Santa is delivering presents to an infinite two-dimensional grid of houses.
+//! >
+//! > He begins by delivering a present to the house at his starting location, and then an elf at the North Pole calls him via radio and tells him where to move next. Moves are always exactly one house to the north (`^`), south (`v`), east (`>`), or west (`<`). After each move, he delivers another present to the house at his new location.
+//! >
+//! > However, the elf back at the north pole has had a little too much eggnog, and so his directions are a little off, and Santa ends up visiting some houses more than once. How many houses receive at least one present?
+//! >
+//! > For example:
+//! >
+//! > - `>` delivers presents to `2` houses: one at the starting location, and one to the east.
+//! > - `^>v<` delivers presents to `4` houses in a square, including twice to the house at his starting/ending location.
+//! > - `^v^v^v^v^v` delivers a bunch of presents to some very lucky children at only `2` houses.
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+//! >
+//! > ## --- Part Two ---
+//! > The next year, to speed up the process, Santa creates a robot version of himself, Robo-Santa, to deliver presents with him.
+//! >
+//! > Santa and Robo-Santa start at the same location (delivering two presents to the same starting house), then take turns moving based on instructions from the elf, who is eggnoggedly reading from the same script as the previous year.
+//! >
+//! > This year, how many houses receive at least one present?
+//! >
+//! > For example:
+//! >
+//! > - `^v` delivers presents to `3` houses, because Santa goes north, and then Robo-Santa goes south.
+//! > - `^>v<` now delivers presents to `3` houses, and Santa and Robo-Santa end up back where they started.
+//! > - `^v^v^v^v^v` now delivers presents to `11` houses, with Santa going one direction and Robo-Santa going the other.
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+//!
+
use std::collections::HashSet;
-#[inline]
fn move_character(pos: (i8, i8), direction: char) -> (i8, i8) {
let mut newpos = pos.clone();
match direction {
diff --git a/src/year_2015/day_04.rs b/src/year_2015/day_04.rs
index c0097dc..956a2b8 100644
--- a/src/year_2015/day_04.rs
+++ b/src/year_2015/day_04.rs
@@ -1,3 +1,24 @@
+//! Advent of Code 2015: Day 4: The Ideal Stocking Stuffer
+//!
+//! # Original exercise:
+//! > ## --- Day 4: The Ideal Stocking Stuffer ---
+//! > Santa needs help mining some AdventCoins (very similar to bitcoins) to use as gifts for all the economically forward-thinking little girls and boys.
+//! >
+//! > To do this, he needs to find MD5 hashes which, in hexadecimal, start with at least five zeroes. The input to the MD5 hash is some secret key (your puzzle input, given below) followed by a number in decimal. To mine AdventCoins, you must find Santa the lowest positive number (no leading zeroes: 1, 2, 3, ...) that produces such a hash.
+//! >
+//! > For example:
+//! >
+//! > - If your secret key is `abcdef`, the answer is `609043`, because the MD5 hash of `abcdef609043` starts with five zeroes (`000001dbbfa...`), and it is the lowest such number to do so.
+//! > - If your secret key is `pqrstuv`, the lowest number it combines with to make an MD5 hash starting with five zeroes is `1048970`; that is, the MD5 hash of `pqrstuv1048970` looks like `000006136ef...`.
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+//! >
+//! > ## --- Part Two ---
+//! > Now find one that starts with six zeroes.
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+//!
+
use md5::{Digest, Md5};
#[mutants::skip] // Don't even try this hahaha
diff --git a/src/year_2015/day_05.rs b/src/year_2015/day_05.rs
index 1fadebc..03c7d19 100644
--- a/src/year_2015/day_05.rs
+++ b/src/year_2015/day_05.rs
@@ -1,3 +1,46 @@
+//! Advent of Code 2015: Day 5: Doesn't He Have Intern-Elves For This?
+//!
+//! # Original exercise:
+//! > ## --- Day 5: Doesn't He Have Intern-Elves For This? ---
+//! > Santa needs help figuring out which strings in his text file are naughty or nice.
+//! >
+//! > A nice string is one with all of the following properties:
+//! >
+//! > - It contains at least three vowels (`aeiou` only), like `aei`, `xazegov`, or `aeiouaeiouaeiou`.
+//! > - It contains at least one letter that appears twice in a row, like `xx`, `abcdde` (`dd`), or `aabbccdd` (`aa`, `bb`, `cc`, or `dd`).
+//! > - It does not contain the strings `ab`, `cd`, `pq`, or `xy`, even if they are part of one of the other requirements.
+//! >
+//! > For example:
+//! >
+//! > - `ugknbfddgicrmopn` is nice because it has at least three vowels (`u...i...o...`), a double letter (`...dd...`), and none of the disallowed substrings.
+//! > - `aaa` is nice because it has at least three vowels and a double letter, even though the letters used by different rules overlap.
+//! > - `jchzalrnumimnmhp` is naughty because it has no double letter.
+//! > - `haegwjzuvuyypxyu` is naughty because it contains the string `xy`.
+//! > - `dvszwmarrgswjxmb` is naughty because it contains only one vowel.
+//! >
+//! > How many strings are nice?
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+//! >
+//! > ## --- Part Two ---
+//! > Realizing the error of his ways, Santa has switched to a better model of determining whether a string is naughty or nice. None of the old rules apply, as they are all clearly ridiculous.
+//! >
+//! > Now, a nice string is one with all of the following properties:
+//! >
+//! > - It contains a pair of any two letters that appears at least twice in the string without overlapping, like `xyxy` (`xy`) or `aabcdefgaa` (`aa`), but not like `aaa` (`aa`, but it overlaps).
+//! > - It contains at least one letter which repeats with exactly one letter between them, like `xyx`, `abcdefeghi` (`efe`), or even `aaa`.
+//! >
+//! > For example:
+//! >
+//! > - `qjhvhtzxzqqjkmpb` is nice because is has a pair that appears twice (`qj`) and a letter that repeats with exactly one letter between them (`zxz`).
+//! > - `xxyxx` is nice because it has a pair that appears twice and a letter that repeats with one between, even though the letters used by each rule overlap.
+//! > - `uurcxstgmygtbstg` is naughty because it has a pair (`tg`) but no repeat with a single letter between them.
+//! > - `ieodomkazucvgmuy` is naughty because it has a repeating letter with one between (`odo`), but no pair that appears twice.
+//! >
+//! > How many strings are nice under these new rules?
+//! >
+//! > Your puzzle answer was ~~`REDACTED`~~.
+
fn string_is_nice_v1(input: &str) -> bool {
let mut vowels: u8 = 0;
let mut repeated = false;
diff --git a/src/year_2015/day_06.rs b/src/year_2015/day_06.rs
index 0159259..79c0a47 100644
--- a/src/year_2015/day_06.rs
+++ b/src/year_2015/day_06.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 6: Probably a Fire Hazard
+
use regex::Regex;
#[inline]
diff --git a/src/year_2015/day_07.rs b/src/year_2015/day_07.rs
index 8ccc6f5..76ad0a5 100644
--- a/src/year_2015/day_07.rs
+++ b/src/year_2015/day_07.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 7: Some Assembly Required
+
use std::collections::HashMap;
enum Operation<'a> {
diff --git a/src/year_2015/day_08.rs b/src/year_2015/day_08.rs
index fa3de90..ef18077 100644
--- a/src/year_2015/day_08.rs
+++ b/src/year_2015/day_08.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 8: Matchsticks
+
fn memory_line_len(line: &str) -> u16 {
let mut line_len = line.len() as u16 - 2;
let mut idx: usize = 1;
diff --git a/src/year_2015/day_09.rs b/src/year_2015/day_09.rs
index 1ee9d45..df0a769 100644
--- a/src/year_2015/day_09.rs
+++ b/src/year_2015/day_09.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 9: All in a Single Night
+
use regex::Regex;
use std::cmp;
use std::collections::HashMap;
diff --git a/src/year_2015/day_10.rs b/src/year_2015/day_10.rs
index afdaf0e..3bab7f6 100644
--- a/src/year_2015/day_10.rs
+++ b/src/year_2015/day_10.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 10: Elves Look, Elves Say
+
use itertools::Itertools;
fn look_and_say(input: Vec) -> Vec {
diff --git a/src/year_2015/day_11.rs b/src/year_2015/day_11.rs
index e10d4c8..419b991 100644
--- a/src/year_2015/day_11.rs
+++ b/src/year_2015/day_11.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 11: Corporate Policy
+
const PASSWORD_SIZE: usize = 8;
fn string_to_chr(input: &str) -> Vec {
diff --git a/src/year_2015/day_12.rs b/src/year_2015/day_12.rs
index e9cb998..6020111 100644
--- a/src/year_2015/day_12.rs
+++ b/src/year_2015/day_12.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 12: JSAbacusFramework.io
+
fn traverse_node_value(input: &Vec, idx: usize) -> (i32, usize) {
let mut total: i32 = 0;
let mut min: i32 = 1;
diff --git a/src/year_2015/day_13.rs b/src/year_2015/day_13.rs
index 2051df7..6c95509 100644
--- a/src/year_2015/day_13.rs
+++ b/src/year_2015/day_13.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 13: Knights of the Dinner Table
+
use regex::Regex;
use std::collections::HashMap;
diff --git a/src/year_2015/day_14.rs b/src/year_2015/day_14.rs
index ca8e75f..72d0bbe 100644
--- a/src/year_2015/day_14.rs
+++ b/src/year_2015/day_14.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 14: Reindeer Olympics
+
use regex::Regex;
const RACE_DURATION: u16 = 2503;
diff --git a/src/year_2015/day_15.rs b/src/year_2015/day_15.rs
index d5346a7..b3c11fe 100644
--- a/src/year_2015/day_15.rs
+++ b/src/year_2015/day_15.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 15: Science for Hungry People
+
use regex::Regex;
struct Ingredient {
diff --git a/src/year_2015/day_16.rs b/src/year_2015/day_16.rs
index 2230959..1639313 100644
--- a/src/year_2015/day_16.rs
+++ b/src/year_2015/day_16.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 16: Aunt Sue
+
use std::collections::HashMap;
const TICKER_TAPE: &str = "children: 3\n\
diff --git a/src/year_2015/day_17.rs b/src/year_2015/day_17.rs
index 76999ec..14874fa 100644
--- a/src/year_2015/day_17.rs
+++ b/src/year_2015/day_17.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 17: No Such Thing as Too Much
+
const EGGNOG_LITERS: usize = 150;
fn parse_file(input: String) -> Vec {
@@ -51,6 +53,7 @@ fn build_solutions(liters: usize, containers: &Vec) -> Vec> {
}
}
+/// Solve exercise for year 2015, day 17 (part 1).
pub fn day_17_v1(input: impl Into) -> usize {
let containers: Vec = parse_file(input.into());
let solutions = build_solutions(EGGNOG_LITERS, &containers);
@@ -58,6 +61,7 @@ pub fn day_17_v1(input: impl Into) -> usize {
solutions.len()
}
+/// Solve exercise for year 2015, day 17 (part 2).
pub fn day_17_v2(input: impl Into) -> usize {
let containers: Vec = parse_file(input.into());
let mut solutions = build_solutions(EGGNOG_LITERS, &containers);
diff --git a/src/year_2015/day_18.rs b/src/year_2015/day_18.rs
index f45cb7f..9ac8f68 100644
--- a/src/year_2015/day_18.rs
+++ b/src/year_2015/day_18.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 18: Like a GIF For Your Yard
+
type LIGHT = bool;
const LIGHT_ON: LIGHT = true;
const LIGHT_OFF: LIGHT = false;
diff --git a/src/year_2015/day_19.rs b/src/year_2015/day_19.rs
index b8f64f8..2c5ce63 100644
--- a/src/year_2015/day_19.rs
+++ b/src/year_2015/day_19.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 19: Medicine for Rudolph
+
use std::collections::{HashMap, HashSet};
fn parse_molecules(input: &str) -> (String, String) {
@@ -26,16 +28,6 @@ fn parse_input(input: &str) -> (HashMap>, String) {
}
fn do_permutations(starter: &str, input: &str, replacements: &Vec) -> HashSet {
- // re_input = /(#{input})/
- // parts = starter.scan(re_input).length
- // replacements.each do |replacement|
- // 0.upto(parts - 1) do |idx|
- // new_str = starter.gsub(re_input).each_with_index do |_part, i|
- // idx == i ? replacement : input
- // end
- // @permutations.push(new_str)
- // end
- // end
let mut permutations: HashSet = HashSet::new();
for (idx, _) in starter.match_indices(input) {
for replacement in replacements.iter() {
@@ -53,13 +45,6 @@ fn do_permutations(starter: &str, input: &str, replacements: &Vec) -> Ha
}
fn calculate_permutations(molecules: &HashMap>, starter: &str) -> usize {
- // @permutations ||= begin
- // @permutations = []
- // @molecules.each do |input, replacements|
- // do_permutations(input, replacements)
- // end
- // @permutations.sort.uniq
- // end
let mut permutations: HashSet = HashSet::new();
for (molecule, replacements) in molecules {
let new_permutations = do_permutations(&starter, &molecule, &replacements);
diff --git a/src/year_2015/day_20.rs b/src/year_2015/day_20.rs
index 023520c..4d5c947 100644
--- a/src/year_2015/day_20.rs
+++ b/src/year_2015/day_20.rs
@@ -1,3 +1,5 @@
+//! Advent of Code 2015: Day 20: Infinite Elves and Infinite Houses
+
fn parse_input(input: &str) -> usize {
let Some(first_line) = input.lines().next() else {
panic!("Invalid input: {}", input)
diff --git a/tests/cli.rs b/tests/cli.rs
index 2b64237..7995cbc 100644
--- a/tests/cli.rs
+++ b/tests/cli.rs
@@ -13,7 +13,7 @@ fn invalid_year_past() -> Result<(), Box> {
}
#[test]
-fn year_2015_day_01_v1() -> Result<(), Box> {
+fn calls_a_proper_test() -> Result<(), Box> {
let mut cmd = Command::cargo_bin("advent-rs")?;
cmd.arg("--year").arg("2015");
cmd.arg("--day").arg("01");
@@ -25,18 +25,3 @@ fn year_2015_day_01_v1() -> Result<(), Box> {
Ok(())
}
-
-#[test]
-fn year_2015_day_01_v2() -> Result<(), Box> {
- let mut cmd = Command::cargo_bin("advent-rs")?;
- cmd.arg("--year").arg("2015");
- cmd.arg("--day").arg("01");
- cmd.arg("--part").arg("2");
- cmd.arg("inputs/year_2015_day_01_input");
- cmd
- .assert()
- .success()
- .stdout(predicates::str::contains("Result: 1771"));
-
- Ok(())
-}
diff --git a/tests/year_2015_test.rs b/tests/year_2015_test.rs
deleted file mode 100644
index a1f0c93..0000000
--- a/tests/year_2015_test.rs
+++ /dev/null
@@ -1,159 +0,0 @@
-use advent_rs::year_2015::day_01;
-use advent_rs::year_2015::day_02;
-use advent_rs::year_2015::day_03;
-use advent_rs::year_2015::day_04;
-use advent_rs::year_2015::day_05;
-use advent_rs::year_2015::day_06;
-use advent_rs::year_2015::day_07;
-use advent_rs::year_2015::day_08;
-use advent_rs::year_2015::day_09;
-use advent_rs::year_2015::day_10;
-use advent_rs::year_2015::day_11;
-use advent_rs::year_2015::day_12;
-use advent_rs::year_2015::day_13;
-use advent_rs::year_2015::day_14;
-use advent_rs::year_2015::day_15;
-use advent_rs::year_2015::day_16;
-use advent_rs::year_2015::day_17;
-use advent_rs::year_2015::day_18;
-use advent_rs::year_2015::day_19;
-use advent_rs::year_2015::day_20;
-
-#[test]
-fn year_2015_day_01() {
- let input = include_str!("../inputs/year_2015_day_01_input");
- assert_eq!(day_01::day_01_v1(input), 138);
- assert_eq!(day_01::day_01_v2(input), 1771);
-}
-
-#[test]
-fn year_2015_day_02() {
- let input = include_str!("../inputs/year_2015_day_02_input");
- assert_eq!(day_02::day_02_v1(input), 1_588_178);
- assert_eq!(day_02::day_02_v2(input), 3_783_758);
-}
-
-#[test]
-fn year_2015_day_03() {
- let input = include_str!("../inputs/year_2015_day_03_input");
- assert_eq!(day_03::day_03_v1(input), 2081);
- assert_eq!(day_03::day_03_v2(input), 2341);
-}
-
-#[test]
-fn year_2015_day_04() {
- let input = include_str!("../inputs/year_2015_day_04_input");
- assert_eq!(day_04::day_04_v1(input), 346_386);
- assert_eq!(day_04::day_04_v2(input), 9_958_218);
-}
-
-#[test]
-fn year_2015_day_05() {
- let input = include_str!("../inputs/year_2015_day_05_input");
- assert_eq!(day_05::day_05_v1(input), 238);
- assert_eq!(day_05::day_05_v2(input), 69);
-}
-
-#[test]
-fn year_2015_day_06() {
- let input = include_str!("../inputs/year_2015_day_06_input");
- assert_eq!(day_06::day_06_v1(input), 400_410);
- assert_eq!(day_06::day_06_v2(input), 15_343_601);
-}
-
-#[test]
-fn year_2015_day_07() {
- let input = include_str!("../inputs/year_2015_day_07_input");
- assert_eq!(day_07::day_07_v1(input), 46_065);
- assert_eq!(day_07::day_07_v2(input), 14_134);
-}
-
-#[test]
-fn year_2015_day_08() {
- let input = include_str!("../inputs/year_2015_day_08_input");
- assert_eq!(day_08::day_08_v1(input), 1_333);
- assert_eq!(day_08::day_08_v2(input), 2_046);
-}
-
-#[test]
-fn year_2015_day_09() {
- let input = include_str!("../inputs/year_2015_day_09_input");
- assert_eq!(day_09::day_09_v1(input), 117);
- assert_eq!(day_09::day_09_v2(input), 909);
-}
-#[test]
-fn year_2015_day_10() {
- let input = include_str!("../inputs/year_2015_day_10_input");
- assert_eq!(day_10::day_10_v1(input), 252_594);
- assert_eq!(day_10::day_10_v2(input), 3_579_328);
-}
-
-#[test]
-fn year_2015_day_11() {
- let input = include_str!("../inputs/year_2015_day_11_input");
- assert_eq!(day_11::day_11_v1(input), "vzbxxyzz");
- assert_eq!(day_11::day_11_v2(input), "vzcaabcc");
-}
-
-#[test]
-fn year_2015_day_12() {
- let input = include_str!("../inputs/year_2015_day_12_input");
- assert_eq!(day_12::day_12_v1(input), 111_754);
- assert_eq!(day_12::day_12_v2(input), 65_402);
-}
-
-#[test]
-fn year_2015_day_13() {
- let input = include_str!("../inputs/year_2015_day_13_input");
- assert_eq!(day_13::day_13_v1(input), 709);
- assert_eq!(day_13::day_13_v2(input), 668);
-}
-
-#[test]
-fn year_2015_day_14() {
- let input = include_str!("../inputs/year_2015_day_14_input");
- assert_eq!(day_14::day_14_v1(input), 2655);
- assert_eq!(day_14::day_14_v2(input), 1059);
-}
-
-#[test]
-fn year_2015_day_15() {
- let input = include_str!("../inputs/year_2015_day_15_input");
- assert_eq!(day_15::day_15_v1(input), 222_870);
- assert_eq!(day_15::day_15_v2(input), 117_936);
-}
-
-#[test]
-fn year_2015_day_16() {
- let input = include_str!("../inputs/year_2015_day_16_input");
- assert_eq!(day_16::day_16_v1(input), 373);
- assert_eq!(day_16::day_16_v2(input), 260);
-}
-
-#[test]
-fn year_2015_day_17() {
- let input = include_str!("../inputs/year_2015_day_17_input");
- assert_eq!(day_17::day_17_v1(input), 1638);
- assert_eq!(day_17::day_17_v2(input), 17);
-}
-
-#[test]
-fn year_2015_day_18() {
- let input = include_str!("../inputs/year_2015_day_18_input");
- assert_eq!(day_18::day_18_v1(input), 821);
- assert_eq!(day_18::day_18_v2(input), 886);
-}
-
-#[test]
-fn year_2015_day_19() {
- let input = include_str!("../inputs/year_2015_day_19_input");
- assert_eq!(day_19::day_19_v1(input), 576);
- assert_eq!(day_19::day_19_v2(input), 207);
-}
-
-#[test]
-fn year_2015_day_20() {
- let input = include_str!("../inputs/year_2015_day_20_input");
- assert_eq!(day_20::day_20_v1(input), 831_600);
- assert_eq!(day_20::day_20_v2(input), 884_520);
-}