Added day 6

This commit is contained in:
Luke Else 2023-12-04 21:21:47 +00:00
parent 6d512470de
commit 1f8afe5af0
3 changed files with 69 additions and 1 deletions

View File

@ -1,7 +1,7 @@
mod solutions; mod solutions;
mod utils; mod utils;
use std::error::Error; use std::{error::Error, sync::{Arc, Mutex}};
use solutions::*; use solutions::*;
@ -12,6 +12,7 @@ fn main() -> Result<(), Box<dyn Error>> {
Box::new(day03::Day03 {}), Box::new(day03::Day03 {}),
Box::new(day04::Day04 {}), Box::new(day04::Day04 {}),
Box::new(day05::Day05 {}), Box::new(day05::Day05 {}),
Box::new(day06::Day06 {}),
]; ];
// Run through and generate solutions // Run through and generate solutions

66
src/solutions/day06.rs Normal file
View File

@ -0,0 +1,66 @@
use super::Solution;
pub struct Day06 {}
impl Solution for Day06 {
fn part1(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready"))
}
fn part2(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
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");
}
}

View File

@ -3,6 +3,7 @@ pub mod day02;
pub mod day03; pub mod day03;
pub mod day04; pub mod day04;
pub mod day05; pub mod day05;
pub mod day06;
use crate::utils::{self, get_input}; use crate::utils::{self, get_input};
use std::{error::Error, fmt::Display, time::SystemTime}; use std::{error::Error, fmt::Display, time::SystemTime};