summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-12-12 14:56:29 -0600
committerToby Vincent <tobyv13@gmail.com>2022-12-12 14:58:44 -0600
commit16e462365ed0f31775e451843c6f10942eca2649 (patch)
tree23d56f065a521a3a7bc540dbe7b58eac1589ac23
parentf7c82ec4f35919a21bbba723a5901731c9cc52a9 (diff)
refactor: rename modules for better consistency
-rw-r--r--aoc_2022/src/day_01.rs (renamed from aoc_2022/src/day_1.rs)6
-rw-r--r--aoc_2022/src/day_02.rs (renamed from aoc_2022/src/day_2.rs)10
-rw-r--r--aoc_2022/src/day_03.rs (renamed from aoc_2022/src/day_3.rs)10
-rw-r--r--aoc_2022/src/day_04.rs (renamed from aoc_2022/src/day_4.rs)10
-rw-r--r--aoc_2022/src/day_05.rs (renamed from aoc_2022/src/day_5.rs)10
-rw-r--r--aoc_2022/src/day_06.rs (renamed from aoc_2022/src/day_6.rs)10
-rw-r--r--aoc_2022/src/day_07.rs (renamed from aoc_2022/src/day_7.rs)10
-rw-r--r--aoc_2022/src/day_08.rs (renamed from aoc_2022/src/day_8.rs)10
-rw-r--r--aoc_2022/src/day_09.rs (renamed from aoc_2022/src/day_9.rs)10
-rw-r--r--aoc_2022/src/lib.rs18
-rw-r--r--aoc_2022/src/main.rs22
11 files changed, 63 insertions, 63 deletions
diff --git a/aoc_2022/src/day_1.rs b/aoc_2022/src/day_01.rs
index c8a7672..b15e9ba 100644
--- a/aoc_2022/src/day_1.rs
+++ b/aoc_2022/src/day_01.rs
@@ -2,15 +2,15 @@ use anyhow::{Context, Result};
use aoc::{Problem, Solution};
-pub struct Day1;
+pub struct Day01;
-impl Problem for Day1 {
+impl Problem for Day01 {
const DAY: u8 = 1;
const INPUT: &'static str = include_str!("../input/day_1.txt");
}
-impl Solution for Day1 {
+impl Solution for Day01 {
type Answer1 = usize;
type Answer2 = usize;
diff --git a/aoc_2022/src/day_2.rs b/aoc_2022/src/day_02.rs
index d14b97d..07ac1f9 100644
--- a/aoc_2022/src/day_2.rs
+++ b/aoc_2022/src/day_02.rs
@@ -106,15 +106,15 @@ impl FromStr for Shape {
}
}
-pub struct Day2;
+pub struct Day02;
-impl Problem for Day2 {
+impl Problem for Day02 {
const DAY: u8 = 3;
const INPUT: &'static str = include_str!("../input/day_2.txt");
}
-impl Solution for Day2 {
+impl Solution for Day02 {
type Answer1 = usize;
type Answer2 = usize;
@@ -160,11 +160,11 @@ mod tests {
#[test]
fn test_part_1_example() -> Result<()> {
- Ok(assert_eq!(15, Day2::part_1(INPUT)?))
+ Ok(assert_eq!(15, Day02::part_1(INPUT)?))
}
#[test]
fn test_part_2_example() -> Result<()> {
- Ok(assert_eq!(12, Day2::part_2(INPUT)?))
+ Ok(assert_eq!(12, Day02::part_2(INPUT)?))
}
}
diff --git a/aoc_2022/src/day_3.rs b/aoc_2022/src/day_03.rs
index 0595f14..d9e2f53 100644
--- a/aoc_2022/src/day_3.rs
+++ b/aoc_2022/src/day_03.rs
@@ -58,15 +58,15 @@ impl std::str::FromStr for Backpack {
}
}
-pub struct Day3;
+pub struct Day03;
-impl Problem for Day3 {
+impl Problem for Day03 {
const DAY: u8 = 3;
const INPUT: &'static str = include_str!("../input/day_3.txt");
}
-impl Solution for Day3 {
+impl Solution for Day03 {
type Answer1 = usize;
type Answer2 = usize;
@@ -112,11 +112,11 @@ mod tests {
#[test]
fn test_part_1_example() -> Result<()> {
- Ok(assert_eq!(157, Day3::part_1(INPUT)?))
+ Ok(assert_eq!(157, Day03::part_1(INPUT)?))
}
#[test]
fn test_part_2_example() -> Result<()> {
- Ok(assert_eq!(70, Day3::part_2(INPUT)?))
+ Ok(assert_eq!(70, Day03::part_2(INPUT)?))
}
}
diff --git a/aoc_2022/src/day_4.rs b/aoc_2022/src/day_04.rs
index 659f76d..0ec0583 100644
--- a/aoc_2022/src/day_4.rs
+++ b/aoc_2022/src/day_04.rs
@@ -25,15 +25,15 @@ fn range_is_union((a, b): &(Range<usize>, Range<usize>)) -> bool {
(a.start <= b.start && a.end >= b.start) || (b.start <= a.start && b.end >= a.start)
}
-pub struct Day4;
+pub struct Day04;
-impl Problem for Day4 {
+impl Problem for Day04 {
const DAY: u8 = 4;
const INPUT: &'static str = include_str!("../input/day_4.txt");
}
-impl Solution for Day4 {
+impl Solution for Day04 {
type Answer1 = usize;
type Answer2 = usize;
@@ -62,13 +62,13 @@ mod tests {
#[test]
fn test_part_1_example() -> Result<()> {
- assert_eq!(2, Day4::part_1(TEST_INPUT)?);
+ assert_eq!(2, Day04::part_1(TEST_INPUT)?);
Ok(())
}
#[test]
fn test_part_2_example() -> Result<()> {
- assert_eq!(4, Day4::part_2(TEST_INPUT)?);
+ assert_eq!(4, Day04::part_2(TEST_INPUT)?);
Ok(())
}
}
diff --git a/aoc_2022/src/day_5.rs b/aoc_2022/src/day_05.rs
index 11347ce..6782d35 100644
--- a/aoc_2022/src/day_5.rs
+++ b/aoc_2022/src/day_05.rs
@@ -156,15 +156,15 @@ impl Display for Stacks {
}
}
-pub struct Day5;
+pub struct Day05;
-impl Problem for Day5 {
+impl Problem for Day05 {
const DAY: u8 = 5;
const INPUT: &'static str = include_str!("../input/day_5.txt");
}
-impl Solution for Day5 {
+impl Solution for Day05 {
type Answer1 = String;
type Answer2 = String;
@@ -202,11 +202,11 @@ mod tests {
#[test]
fn test_part_1_example() -> Result<()> {
- Ok(assert_eq!("CMZ", Day5::part_1(TEST_INPUT)?))
+ Ok(assert_eq!("CMZ", Day05::part_1(TEST_INPUT)?))
}
#[test]
fn test_part_2_example() -> Result<()> {
- Ok(assert_eq!("MCD", Day5::part_2(TEST_INPUT)?))
+ Ok(assert_eq!("MCD", Day05::part_2(TEST_INPUT)?))
}
}
diff --git a/aoc_2022/src/day_6.rs b/aoc_2022/src/day_06.rs
index 5abef0a..3961329 100644
--- a/aoc_2022/src/day_6.rs
+++ b/aoc_2022/src/day_06.rs
@@ -20,15 +20,15 @@ fn get_window_pos(input: &str, win_size: usize) -> Option<usize> {
.map(|i| i + win_size)
}
-pub struct Day6;
+pub struct Day06;
-impl Problem for Day6 {
+impl Problem for Day06 {
const DAY: u8 = 6;
const INPUT: &'static str = include_str!("../input/day_6.txt");
}
-impl Solution for Day6 {
+impl Solution for Day06 {
type Answer1 = usize;
type Answer2 = usize;
@@ -56,7 +56,7 @@ mod tests {
("zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw", 11),
];
for test in tests {
- assert_eq!(test.1, Day6::part_1(test.0)?);
+ assert_eq!(test.1, Day06::part_1(test.0)?);
}
Ok(())
@@ -72,7 +72,7 @@ mod tests {
("zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw", 26),
];
for test in tests {
- assert_eq!(test.1, Day6::part_2(test.0)?);
+ assert_eq!(test.1, Day06::part_2(test.0)?);
}
Ok(())
diff --git a/aoc_2022/src/day_7.rs b/aoc_2022/src/day_07.rs
index 09eb1ef..21dceae 100644
--- a/aoc_2022/src/day_7.rs
+++ b/aoc_2022/src/day_07.rs
@@ -143,15 +143,15 @@ impl Display for FileSystem {
}
}
-pub struct Day7;
+pub struct Day07;
-impl Problem for Day7 {
+impl Problem for Day07 {
const DAY: u8 = 7;
const INPUT: &'static str = include_str!("../input/day_7.txt");
}
-impl Solution for Day7 {
+impl Solution for Day07 {
type Answer1 = usize;
type Answer2 = usize;
@@ -207,11 +207,11 @@ mod tests {
#[test]
fn test_part_1_example() -> Result<()> {
- Ok(assert_eq!(95437, Day7::part_1(TEST_INPUT)?))
+ Ok(assert_eq!(95437, Day07::part_1(TEST_INPUT)?))
}
#[test]
fn test_part_2_example() -> Result<()> {
- Ok(assert_eq!(24933642, Day7::part_2(TEST_INPUT)?))
+ Ok(assert_eq!(24933642, Day07::part_2(TEST_INPUT)?))
}
}
diff --git a/aoc_2022/src/day_8.rs b/aoc_2022/src/day_08.rs
index 6c44462..17b49f5 100644
--- a/aoc_2022/src/day_8.rs
+++ b/aoc_2022/src/day_08.rs
@@ -250,15 +250,15 @@ impl Display for Tree {
}
}
-pub struct Day8;
+pub struct Day08;
-impl Problem for Day8 {
+impl Problem for Day08 {
const DAY: u8 = 8;
const INPUT: &'static str = include_str!("../input/day_8.txt");
}
-impl Solution for Day8 {
+impl Solution for Day08 {
type Answer1 = usize;
type Answer2 = usize;
@@ -315,12 +315,12 @@ mod tests {
#[test]
fn test_part_1_example() -> Result<()> {
- Ok(assert_eq!(21, Day8::part_1(TEST_INPUT)?))
+ Ok(assert_eq!(21, Day08::part_1(TEST_INPUT)?))
}
#[test]
fn test_part_2_example() -> Result<()> {
println!("{TEST_INPUT}");
- Ok(assert_eq!(8, Day8::part_2(TEST_INPUT)?))
+ Ok(assert_eq!(8, Day08::part_2(TEST_INPUT)?))
}
}
diff --git a/aoc_2022/src/day_9.rs b/aoc_2022/src/day_09.rs
index 3d521af..7d9e55b 100644
--- a/aoc_2022/src/day_9.rs
+++ b/aoc_2022/src/day_09.rs
@@ -97,15 +97,15 @@ impl List {
}
}
-pub struct Day9;
+pub struct Day09;
-impl Problem for Day9 {
+impl Problem for Day09 {
const DAY: u8 = 9;
const INPUT: &'static str = include_str!("../input/day_9.txt");
}
-impl Solution for Day9 {
+impl Solution for Day09 {
type Answer1 = usize;
type Answer2 = usize;
@@ -161,7 +161,7 @@ mod tests {
R 2
"#};
- Ok(assert_eq!(13, Day9::part_1(test_input)?))
+ Ok(assert_eq!(13, Day09::part_1(test_input)?))
}
#[test]
@@ -177,6 +177,6 @@ mod tests {
U 20
"#};
- Ok(assert_eq!(36, Day9::part_2(test_input)?))
+ Ok(assert_eq!(36, Day09::part_2(test_input)?))
}
}
diff --git a/aoc_2022/src/lib.rs b/aoc_2022/src/lib.rs
index 2483772..df0ce86 100644
--- a/aoc_2022/src/lib.rs
+++ b/aoc_2022/src/lib.rs
@@ -2,13 +2,13 @@
#![feature(iter_next_chunk)]
#![feature(is_some_and)]
-pub mod day_1;
-pub mod day_2;
-pub mod day_3;
-pub mod day_4;
-pub mod day_5;
-pub mod day_6;
-pub mod day_7;
-pub mod day_8;
-pub mod day_9;
+pub mod day_01;
+pub mod day_02;
+pub mod day_03;
+pub mod day_04;
+pub mod day_05;
+pub mod day_06;
+pub mod day_07;
+pub mod day_08;
+pub mod day_09;
pub mod day_10;
diff --git a/aoc_2022/src/main.rs b/aoc_2022/src/main.rs
index 1dd90df..a2fd8ae 100644
--- a/aoc_2022/src/main.rs
+++ b/aoc_2022/src/main.rs
@@ -1,20 +1,20 @@
use anyhow::Result;
use aoc::Solution;
use aoc_2022::{
- day_1::Day1, day_10::Day10, day_2::Day2, day_3::Day3, day_4::Day4, day_5::Day5, day_6::Day6,
- day_7::Day7, day_8::Day8, day_9::Day9,
+ day_01::Day01, day_02::Day02, day_03::Day03, day_04::Day04, day_05::Day05, day_06::Day06,
+ day_07::Day07, day_08::Day08, day_09::Day09, day_10::Day10,
};
fn main() -> Result<()> {
- Day1::solve()?;
- Day2::solve()?;
- Day3::solve()?;
- Day4::solve()?;
- Day5::solve()?;
- Day6::solve()?;
- Day7::solve()?;
- Day8::solve()?;
- Day9::solve()?;
+ Day01::solve()?;
+ Day02::solve()?;
+ Day03::solve()?;
+ Day04::solve()?;
+ Day05::solve()?;
+ Day06::solve()?;
+ Day07::solve()?;
+ Day08::solve()?;
+ Day09::solve()?;
Day10::solve()?;
Ok(())