From 1f8afe5af0ace0cc9b74cb9662e1c8f1d2ea1b23 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Mon, 4 Dec 2023 21:21:47 +0000 Subject: [PATCH] Added day 6 --- src/main.rs | 3 +- src/solutions/day06.rs | 66 ++++++++++++++++++++++++++++++++++++++++++ src/solutions/mod.rs | 1 + 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/solutions/day06.rs diff --git a/src/main.rs b/src/main.rs index 0528315..318ca4b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ mod solutions; mod utils; -use std::error::Error; +use std::{error::Error, sync::{Arc, Mutex}}; use solutions::*; @@ -12,6 +12,7 @@ fn main() -> Result<(), Box> { Box::new(day03::Day03 {}), Box::new(day04::Day04 {}), Box::new(day05::Day05 {}), + Box::new(day06::Day06 {}), ]; // Run through and generate solutions diff --git a/src/solutions/day06.rs b/src/solutions/day06.rs new file mode 100644 index 0000000..9bcb1a0 --- /dev/null +++ b/src/solutions/day06.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day06 {} + +impl Solution for Day06 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 5 + } +} + +impl Day06 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day06::Day06 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day06::Day06 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} diff --git a/src/solutions/mod.rs b/src/solutions/mod.rs index 367c960..65e27a3 100644 --- a/src/solutions/mod.rs +++ b/src/solutions/mod.rs @@ -3,6 +3,7 @@ pub mod day02; pub mod day03; pub mod day04; pub mod day05; +pub mod day06; use crate::utils::{self, get_input}; use std::{error::Error, fmt::Display, time::SystemTime};