1
0
Fork 0

fix: move the testing macro out

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-12-04 10:59:51 +01:00
parent 8757b394d1
commit 142dccf8f1
Signed by: mfocko
GPG key ID: 7C47D46246790496
2 changed files with 24 additions and 24 deletions

View file

@ -63,27 +63,3 @@ pub trait Solution<Output1: Display, Output2: Display> {
Self::run("input") 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);
}
}
};
}

View file

@ -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);
}
}
};
}