diff --git a/src/solutions/day01.rs b/src/solutions/day01.rs index 1de95e1..505f128 100644 --- a/src/solutions/day01.rs +++ b/src/solutions/day01.rs @@ -94,3 +94,34 @@ impl Day01 { } } } + +/// Test from puzzle input +#[cfg(test)] +mod test { + use crate::*; + use super::*; + + #[test] + fn part1() { + let challenge = day01::Day01{}; + + //Complete the Challenge + let answer = challenge.part1( + get_input(challenge.get_day(), utils::InputType::Test1).unwrap().as_mut() + ).unwrap().to_string(); + + assert_eq!(answer, "142"); + } + + #[test] + fn part2() { + let challenge = day01::Day01{}; + + //Complete the Challenge + let answer = challenge.part2( + get_input(challenge.get_day(), utils::InputType::Test2).unwrap().as_mut() + ).unwrap().to_string(); + + assert_eq!(answer, "281"); + } +} diff --git a/src/solutions/day02.rs b/src/solutions/day02.rs index 4048635..0c4b067 100644 --- a/src/solutions/day02.rs +++ b/src/solutions/day02.rs @@ -25,3 +25,35 @@ impl Solution for Day02 { impl Day02 { } + + +/// Test from puzzle input +#[cfg(test)] +mod test { + use crate::*; + use super::*; + + #[test] + fn part1() { + let challenge = day02::Day02{}; + + //Complete the Challenge + let answer = challenge.part1( + 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( + get_input(challenge.get_day(), utils::InputType::Test2).unwrap().as_mut() + ).unwrap().to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file