Test are only compiled when testing

This commit is contained in:
Dreaded_X 2022-12-03 04:26:39 +01:00
parent 02e048b421
commit 0f25ef7775
Signed by: Dreaded_X
GPG Key ID: 76BDEC4E165D8AD9
3 changed files with 60 additions and 39 deletions

View File

@ -1,10 +1,15 @@
// -- Setup & Runners --
use anyhow::Result;
use aoc::Solver;
pub struct Day;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(aoc::Part::ONE, "test-1", 24000)
@ -21,8 +26,10 @@ fn part1_solution() -> Result<()> {
fn part2_solution() -> Result<()> {
Day::test(aoc::Part::TWO, "input", 206582)
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
fn day() -> u8 {
1

View File

@ -1,10 +1,15 @@
// -- Setup & Runners --
use anyhow::Result;
use aoc::Solver;
pub struct Day;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(aoc::Part::ONE, "test-1", 15)
@ -21,6 +26,7 @@ fn part1_solution() -> Result<()> {
fn part2_solution() -> Result<()> {
Day::test(aoc::Part::TWO, "input", 12382)
}
}
// -- Implementation for hand --
#[derive(Debug, Copy, Clone)]
@ -102,6 +108,7 @@ fn calc_score(sum: u32, (a, b): (Hand, Hand)) -> u32 {
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
fn day() -> u8 {
2

View File

@ -1,16 +1,23 @@
// -- Setup & Runners --
use anyhow::Result;
use aoc::Solver;
pub struct Day;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(aoc::Part::ONE, "test-1", 0)
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
fn day() -> u8 {
todo!("Day not set")