fix: move the testing macro out
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
8757b394d1
commit
142dccf8f1
2 changed files with 24 additions and 24 deletions
|
@ -63,27 +63,3 @@ pub trait Solution<Output1: Display, Output2: Display> {
|
|||
Self::run("input")
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! test_sample {
|
||||
($mod_name:ident, $day_struct:tt, $part_1:expr, $part_2:expr) => {
|
||||
#[cfg(test)]
|
||||
mod $mod_name {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn part_1() {
|
||||
let path = $day_struct::get_sample(1);
|
||||
let mut day = $day_struct::new(path);
|
||||
assert_eq!(day.part_1(), $part_1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn part_2() {
|
||||
let path = $day_struct::get_sample(2);
|
||||
let mut day = $day_struct::new(path);
|
||||
assert_eq!(day.part_2(), $part_2);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1 +1,25 @@
|
|||
//! # Testing-related utilities
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! test_sample {
|
||||
($mod_name:ident, $day_struct:tt, $part_1:expr, $part_2:expr) => {
|
||||
#[cfg(test)]
|
||||
mod $mod_name {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn part_1() {
|
||||
let path = $day_struct::get_sample(1);
|
||||
let mut day = $day_struct::new(path);
|
||||
assert_eq!(day.part_1(), $part_1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn part_2() {
|
||||
let path = $day_struct::get_sample(2);
|
||||
let mut day = $day_struct::new(path);
|
||||
assert_eq!(day.part_2(), $part_2);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue