Created template for advent of code in rust
This commit is contained in:
66
src/solutions/day01.rs
Normal file
66
src/solutions/day01.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day01 {}
|
||||
|
||||
impl Solution for Day01 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
impl Day01 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day01::Day01 {};
|
||||
|
||||
//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 = day01::Day01 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day02.rs
Normal file
66
src/solutions/day02.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day02 {}
|
||||
|
||||
impl Solution for Day02 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
2
|
||||
}
|
||||
}
|
||||
|
||||
impl Day02 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day02::Day02 {};
|
||||
|
||||
//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 = day02::Day02 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day03.rs
Normal file
66
src/solutions/day03.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day03 {}
|
||||
|
||||
impl Solution for Day03 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
3
|
||||
}
|
||||
}
|
||||
|
||||
impl Day03 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day03::Day03 {};
|
||||
|
||||
//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 = day03::Day03 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day04.rs
Normal file
66
src/solutions/day04.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day04 {}
|
||||
|
||||
impl Solution for Day04 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
4
|
||||
}
|
||||
}
|
||||
|
||||
impl Day04 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day04::Day04 {};
|
||||
|
||||
//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 = day04::Day04 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day05.rs
Normal file
66
src/solutions/day05.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day05 {}
|
||||
|
||||
impl Solution for Day05 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
5
|
||||
}
|
||||
}
|
||||
|
||||
impl Day05 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day05::Day05 {};
|
||||
|
||||
//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 = day05::Day05 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
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 + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
6
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
66
src/solutions/day07.rs
Normal file
66
src/solutions/day07.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day07 {}
|
||||
|
||||
impl Solution for Day07 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
7
|
||||
}
|
||||
}
|
||||
|
||||
impl Day07 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day07::Day07 {};
|
||||
|
||||
//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 = day07::Day07 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day08.rs
Normal file
66
src/solutions/day08.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day08 {}
|
||||
|
||||
impl Solution for Day08 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
8
|
||||
}
|
||||
}
|
||||
|
||||
impl Day08 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day08::Day08 {};
|
||||
|
||||
//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 = day08::Day08 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day09.rs
Normal file
66
src/solutions/day09.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day09 {}
|
||||
|
||||
impl Solution for Day09 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
9
|
||||
}
|
||||
}
|
||||
|
||||
impl Day09 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day09::Day09 {};
|
||||
|
||||
//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 = day09::Day09 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day10.rs
Normal file
66
src/solutions/day10.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day10 {}
|
||||
|
||||
impl Solution for Day10 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
10
|
||||
}
|
||||
}
|
||||
|
||||
impl Day10 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day10::Day10 {};
|
||||
|
||||
//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 = day10::Day10 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day11.rs
Normal file
66
src/solutions/day11.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day11 {}
|
||||
|
||||
impl Solution for Day11 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
11
|
||||
}
|
||||
}
|
||||
|
||||
impl Day11 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day11::Day11 {};
|
||||
|
||||
//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 = day11::Day11 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day12.rs
Normal file
66
src/solutions/day12.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day12 {}
|
||||
|
||||
impl Solution for Day12 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
12
|
||||
}
|
||||
}
|
||||
|
||||
impl Day12 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day12::Day12 {};
|
||||
|
||||
//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 = day12::Day12 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day13.rs
Normal file
66
src/solutions/day13.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day13 {}
|
||||
|
||||
impl Solution for Day13 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
13
|
||||
}
|
||||
}
|
||||
|
||||
impl Day13 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day13::Day13 {};
|
||||
|
||||
//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 = day13::Day13 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day14.rs
Normal file
66
src/solutions/day14.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day14 {}
|
||||
|
||||
impl Solution for Day14 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
14
|
||||
}
|
||||
}
|
||||
|
||||
impl Day14 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day14::Day14 {};
|
||||
|
||||
//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 = day14::Day14 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day15.rs
Normal file
66
src/solutions/day15.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day15 {}
|
||||
|
||||
impl Solution for Day15 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
15
|
||||
}
|
||||
}
|
||||
|
||||
impl Day15 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day15::Day15 {};
|
||||
|
||||
//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 = day15::Day15 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day16.rs
Normal file
66
src/solutions/day16.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day16 {}
|
||||
|
||||
impl Solution for Day16 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
16
|
||||
}
|
||||
}
|
||||
|
||||
impl Day16 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day16::Day16 {};
|
||||
|
||||
//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 = day16::Day16 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day17.rs
Normal file
66
src/solutions/day17.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day17 {}
|
||||
|
||||
impl Solution for Day17 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
17
|
||||
}
|
||||
}
|
||||
|
||||
impl Day17 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day17::Day17 {};
|
||||
|
||||
//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 = day17::Day17 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day18.rs
Normal file
66
src/solutions/day18.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day18 {}
|
||||
|
||||
impl Solution for Day18 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
18
|
||||
}
|
||||
}
|
||||
|
||||
impl Day18 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day18::Day18 {};
|
||||
|
||||
//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 = day18::Day18 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day19.rs
Normal file
66
src/solutions/day19.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day19 {}
|
||||
|
||||
impl Solution for Day19 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
19
|
||||
}
|
||||
}
|
||||
|
||||
impl Day19 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day19::Day19 {};
|
||||
|
||||
//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 = day19::Day19 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day20.rs
Normal file
66
src/solutions/day20.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day20 {}
|
||||
|
||||
impl Solution for Day20 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
20
|
||||
}
|
||||
}
|
||||
|
||||
impl Day20 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day20::Day20 {};
|
||||
|
||||
//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 = day20::Day20 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day21.rs
Normal file
66
src/solutions/day21.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day21 {}
|
||||
|
||||
impl Solution for Day21 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
21
|
||||
}
|
||||
}
|
||||
|
||||
impl Day21 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day21::Day21 {};
|
||||
|
||||
//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 = day21::Day21 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day22.rs
Normal file
66
src/solutions/day22.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day22 {}
|
||||
|
||||
impl Solution for Day22 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
22
|
||||
}
|
||||
}
|
||||
|
||||
impl Day22 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day22::Day22 {};
|
||||
|
||||
//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 = day22::Day22 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day23.rs
Normal file
66
src/solutions/day23.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day23 {}
|
||||
|
||||
impl Solution for Day23 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
23
|
||||
}
|
||||
}
|
||||
|
||||
impl Day23 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day23::Day23 {};
|
||||
|
||||
//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 = day23::Day23 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day24.rs
Normal file
66
src/solutions/day24.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day24 {}
|
||||
|
||||
impl Solution for Day24 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
24
|
||||
}
|
||||
}
|
||||
|
||||
impl Day24 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day24::Day24 {};
|
||||
|
||||
//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 = day24::Day24 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/day25.rs
Normal file
66
src/solutions/day25.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct Day25 {}
|
||||
|
||||
impl Solution for Day25 {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
25
|
||||
}
|
||||
}
|
||||
|
||||
impl Day25 {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = day25::Day25 {};
|
||||
|
||||
//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 = day25::Day25 {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
66
src/solutions/dayxx.rs
Normal file
66
src/solutions/dayxx.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use super::Solution;
|
||||
|
||||
pub struct DayXX {}
|
||||
|
||||
impl Solution for DayXX {
|
||||
fn part1(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn part2(
|
||||
&self,
|
||||
_input: &mut Vec<String>,
|
||||
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
|
||||
Ok(Box::new("Ready"))
|
||||
}
|
||||
|
||||
fn get_day(&self) -> u8 {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
impl DayXX {}
|
||||
|
||||
/// Test from puzzle input
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let challenge = dayXX::DayXX {};
|
||||
|
||||
//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 = dayXX::DayXX {};
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
58
src/solutions/mod.rs
Normal file
58
src/solutions/mod.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
pub mod day01;
|
||||
pub mod day02;
|
||||
pub mod day03;
|
||||
pub mod day04;
|
||||
pub mod day05;
|
||||
pub mod day06;
|
||||
pub mod day07;
|
||||
pub mod day08;
|
||||
pub mod day09;
|
||||
pub mod day10;
|
||||
pub mod day11;
|
||||
pub mod day12;
|
||||
pub mod day13;
|
||||
pub mod day14;
|
||||
pub mod day15;
|
||||
pub mod day16;
|
||||
pub mod day17;
|
||||
pub mod day18;
|
||||
pub mod day19;
|
||||
pub mod day20;
|
||||
pub mod day21;
|
||||
pub mod day22;
|
||||
pub mod day23;
|
||||
pub mod day24;
|
||||
pub mod day25;
|
||||
|
||||
use crate::utils::{self, get_input};
|
||||
use std::{error::Error, fmt::Display, time::SystemTime};
|
||||
|
||||
pub trait Solution {
|
||||
fn part1(&self, input: &mut Vec<String>) -> Result<Box<dyn Display + Sync>, Box<dyn Error>>;
|
||||
fn part2(&self, input: &mut Vec<String>) -> Result<Box<dyn Display + Sync>, Box<dyn Error>>;
|
||||
fn get_day(&self) -> u8;
|
||||
|
||||
fn run(&self) -> Result<Run, Box<dyn std::error::Error>> {
|
||||
let start_time = SystemTime::now();
|
||||
|
||||
self.part1(get_input(self.get_day(), utils::InputType::Test1)?.as_mut())?;
|
||||
self.part2(get_input(self.get_day(), utils::InputType::Test2)?.as_mut())?;
|
||||
|
||||
let run = Run {
|
||||
part1: self.part1(get_input(self.get_day(), utils::InputType::Actual)?.as_mut())?,
|
||||
part2: self.part2(get_input(self.get_day(), utils::InputType::Actual)?.as_mut())?,
|
||||
day: self.get_day(),
|
||||
time: SystemTime::now().duration_since(start_time)?,
|
||||
};
|
||||
Ok(run)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Run {
|
||||
pub part1: Box<dyn Display + Sync>,
|
||||
pub part2: Box<dyn Display + Sync>,
|
||||
pub day: u8,
|
||||
pub time: core::time::Duration,
|
||||
}
|
||||
|
||||
unsafe impl Send for Run {}
|
Reference in New Issue
Block a user