diff --git a/2020/setup_day.sh b/2020/setup_day.sh index f07c213..5187d9f 100755 --- a/2020/setup_day.sh +++ b/2020/setup_day.sh @@ -12,8 +12,23 @@ xsel -b > input # add trailing newline if necessary sed -i -e '$a\' input -echo 'fn read_input() -> String { - std::fs::read_to_string("input").unwrap() +echo ' +#![feature(test)] +extern crate test; +use std::env; + +fn read_input() -> String { + std::fs::read_to_string(env::args().nth(1).unwrap_or(String::from("input"))).unwrap() +} + +fn parse_input(raw: &str) -> ! { + unimplemented!() +} + +fn main() { + let input = parse_input(&read_input()); + println!("Part 1: {}", part1(&input)); + println!("Part 2: {}", part2(&input)); } #[cfg(test)] @@ -21,4 +36,6 @@ mod tests { use super::*; use test::black_box; + const TEST_INPUT: &str = ""; + }' >> src/main.rs