use anyhow::Result; pub trait Day { fn init(content: String) -> Result where Self: Sized; fn part1(&self) -> Result; fn part2(&self) -> Result; } #[macro_export] macro_rules! day_tests { ($day_struct:ty, $day_number:expr, $part1_expected:expr, $part2_expected:expr) => { #[test] fn part1_real() -> anyhow::Result<()> { use crate::day::Day; let d = <$day_struct>::init(crate::load_input($day_number)?)?; assert_eq!($part1_expected, d.part1()?); Ok(()) } #[test] fn part2_real() -> anyhow::Result<()> { use crate::day::Day; let d = <$day_struct>::init(crate::load_input($day_number)?)?; assert_eq!($part2_expected, d.part2()?); Ok(()) } }; }