1
0
Fork 0
2023/src/testing.rs
Matej Focko 142dccf8f1
fix: move the testing macro out
Signed-off-by: Matej Focko <mfocko@redhat.com>
2023-12-04 10:59:51 +01:00

25 lines
679 B
Rust

//! # 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);
}
}
};
}