From: Grégory Burri Date: Thu, 16 Jul 2020 09:50:47 +0000 (+0200) Subject: Update dependencies and readme X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=881d42dccbc8967ae0b328ce44d1b529a8d49221;p=advent_of_code_2019.git Update dependencies and readme --- diff --git a/Cargo.toml b/Cargo.toml index 40784cc..292bbbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,8 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -itertools = "0.8" -threadpool = "1.7" +itertools = "0.9" +threadpool = "1.8" regex = "1" -num = "0.2" -num_enum = "0.4" \ No newline at end of file +num = "0.3" +num_enum = "0.5" \ No newline at end of file diff --git a/README.md b/README.md index d438ab1..f6047d0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,27 @@ # AdventOfCode2019 https://adventofcode.com/2019 + + +# Running tests + +Example for day 1 tests: + +~~~ +cargo test day01 -- --nocapture +~~~ + +All tests: + +~~~ +cargo test -- --nocapture +~~~ + + +# Running a day code + +~~~ +cargo run -- n +~~~ + +Where 'n' is a number from 1 to 25 \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 8c2f600..f249fb7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -197,9 +197,14 @@ fn main() { println!("Time to execute all days: {}", format_micros(now.elapsed().as_micros())); } else { for arg in args { - let day = arg.parse::().unwrap(); - if day > days.len() { panic!("Unknown day: {}", day) } - do_day(&days, day) + match arg.parse::() { + Ok(day) if day >= 1 && day <= days.len() => + do_day(&days, day), + Ok(day) => + println!("Unknown day: {}", day), + Err(error) => + println!("Unable to parse day number: \"{}\", error: {}", arg, error) + } } } }