#[macro_export]
macro_rules! solve {
($sols:ty, $day:expr) => {
<$sols as ::lib_aoc::Solution<$day>>::run();
};
}
#[macro_export]
macro_rules! solve_through {
($sols:ty, $up_to:literal) => {
::lib_aoc::seq!(N in 1..=$up_to {
<$sols as ::lib_aoc::Solution<N>>::run();
})
};
}
#[macro_export]
macro_rules! solution_array {
($sols:ty, $up_to:literal) => {
::lib_aoc::seq!(N in 1..=$up_to {
[
#(
|| { <$sols as ::lib_aoc::Solution<N>>::run(); },
)*
]
})
};
}
#[macro_export]
macro_rules! derive_tests {
($sols:ty, $day:expr) => {
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part_one() {
let expected = <$sols as ::lib_aoc::Test<$day>>::expected(false);
let input = <$sols as ::lib_aoc::Solver>::load_test($day, PART_ONE);
let parsed = <$sols as ::lib_aoc::Solution<$day>>::parse(&input);
let outcome = <$sols as ::lib_aoc::Solution<$day>>::part_one(&parsed);
assert_eq!(outcome, expected);
}
#[test]
fn part_two() {
let expected = <$sols as ::lib_aoc::Test<$day>>::expected(true);
let input = <$sols as ::lib_aoc::Solver>::load_test($day, PART_TWO);
let parsed = <$sols as ::lib_aoc::Solution<$day>>::parse(&input);
let outcome = <$sols as ::lib_aoc::Solution<$day>>::part_two(&parsed);
assert_eq!(outcome, expected);
}
}
};
}