From fd24918c7a9933a2eb4767ba85b3a4685ebbda8a Mon Sep 17 00:00:00 2001 From: Keenan Tims Date: Sat, 30 Nov 2024 21:36:05 -0800 Subject: [PATCH] 2024 AoC is here! --- boilerplate/src/main.rs | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 boilerplate/src/main.rs diff --git a/boilerplate/src/main.rs b/boilerplate/src/main.rs new file mode 100644 index 0000000..e6bd15f --- /dev/null +++ b/boilerplate/src/main.rs @@ -0,0 +1,55 @@ +use std::fs::File; +use std::io::{BufRead, BufReader, Lines}; +use std::time::Instant; + +// BOILERPLATE +type InputIter = Lines>; + +fn get_input() -> InputIter { + let f = File::open("input").unwrap(); + let br = BufReader::new(f); + br.lines() +} + +fn main() { + let start = Instant::now(); + let ans1 = problem1(get_input()); + let duration = start.elapsed(); + println!("Problem 1 solution: {} [{}s]", ans1, duration.as_secs_f64()); + + let start = Instant::now(); + let ans2 = problem2(get_input()); + let duration = start.elapsed(); + println!("Problem 2 solution: {} [{}s]", ans2, duration.as_secs_f64()); +} + +// PROBLEM 1 solution + +fn problem1(input: Lines) -> u64 { + 0 +} + +// PROBLEM 2 solution +fn problem2(input: Lines) -> u64 { + 0 +} + +#[cfg(test)] +mod tests { + use crate::*; + use std::io::Cursor; + + const EXAMPLE: &str = &""; + + #[test] + fn problem1_example() { + let c = Cursor::new(EXAMPLE); + assert_eq!(problem1(c.lines()), 0); + } + + #[test] + fn problem2_example() { + let c = Cursor::new(EXAMPLE); + assert_eq!(problem2(c.lines()), 0); + } +}