# 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
# 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
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)
+ }
}
}
}