Made everything a bit more rustic

This commit is contained in:
Rüdiger Ludwig 2023-07-29 17:02:25 +02:00
parent 7f5b6e03f9
commit a5f19ecae1
22 changed files with 376 additions and 274 deletions

View file

@ -1,6 +1,7 @@
use super::template::{DayTrait, ResultType};
use thiserror::Error;
const DAY_NUMBER: usize = 0;
const DAY_NUMBER: usize = todo!();
pub struct Day;
@ -9,25 +10,31 @@ impl DayTrait for Day {
DAY_NUMBER
}
fn part1(&self, _lines: &[String]) -> anyhow::Result<ResultType> {
fn part1(&self, lines: &str) -> anyhow::Result<ResultType> {
Ok(ResultType::Nothing)
}
fn part2(&self, _lines: &[String]) -> anyhow::Result<ResultType> {
fn part2(&self, lines: &str) -> anyhow::Result<ResultType> {
Ok(ResultType::Nothing)
}
}
#[derive(Debug, Error)]
enum DayError {
#[error("Dummy")]
Dummy,
}
#[cfg(test)]
mod test {
use super::*;
use crate::common::file::read_lines;
use crate::common::file::read_string;
use anyhow::Result;
#[test]
fn test_part1() -> Result<()> {
let day = Day {};
let lines = read_lines(day.get_day_number(), "example01.txt")?;
let lines = read_string(day.get_day_number(), "example01.txt")?;
let expected = ResultType::Nothing;
let result = day.part1(&lines)?;
assert_eq!(result, expected);
@ -38,7 +45,7 @@ mod test {
#[test]
fn test_part2() -> Result<()> {
let day = Day {};
let lines = read_lines(day.get_day_number(), "example01.txt")?;
let lines = read_string(day.get_day_number(), "example01.txt")?;
let expected = ResultType::Nothing;
let result = day.part2(&lines)?;
assert_eq!(result, expected);