Update dependencies and readme
authorGrégory Burri <gregory.burri@matisa.ch>
Thu, 16 Jul 2020 09:50:47 +0000 (11:50 +0200)
committerGrégory Burri <gregory.burri@matisa.ch>
Thu, 16 Jul 2020 09:50:47 +0000 (11:50 +0200)
Cargo.toml
README.md
src/main.rs

index 40784cc..292bbbd 100644 (file)
@@ -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
index d438ab1..f6047d0 100644 (file)
--- 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
index 8c2f600..f249fb7 100644 (file)
@@ -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::<usize>().unwrap();
-            if day > days.len() { panic!("Unknown day: {}", day) }
-            do_day(&days, day)
+            match arg.parse::<usize>() {
+                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)
+            }
         }
     }
 }