Created a set of unit tests each day
This commit is contained in:
parent
5a677ea222
commit
4267b68253
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user