Added day 6
This commit is contained in:
parent
6d512470de
commit
1f8afe5af0
@ -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
66
src/solutions/day06.rs
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
@ -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};
|
||||||
|
Loading…
Reference in New Issue
Block a user