From 08491f4e7e21ca2e59aaeb90aee0982add800859 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Sun, 6 Dec 2020 02:11:04 -0800 Subject: Add regression tests. --- 03/Cargo.toml | 3 +++ 03/tests/main.rs | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 03/tests/main.rs (limited to '03') diff --git a/03/Cargo.toml b/03/Cargo.toml index cffd384..189ca3f 100644 --- a/03/Cargo.toml +++ b/03/Cargo.toml @@ -6,3 +6,6 @@ edition = "2018" [dependencies] advent_lib = { path = "../lib" } + +[dev-dependencies] +assert_cmd = "0.10" diff --git a/03/tests/main.rs b/03/tests/main.rs new file mode 100644 index 0000000..f68eee5 --- /dev/null +++ b/03/tests/main.rs @@ -0,0 +1,21 @@ +use assert_cmd::prelude::*; +//use predicates::prelude::*; +use std::process::Command; + + +#[test] +fn personal_input() -> Result<(), Box> { + let mut command = Command::cargo_bin("advent_03")?; + + command.arg("input"); + command.assert().success().stdout( + "dx: 1, dy: 1, trees: 60\n\ + dx: 3, dy: 1, trees: 225\n\ + dx: 5, dy: 1, trees: 57\n\ + dx: 7, dy: 1, trees: 58\n\ + dx: 1, dy: 2, trees: 25\n\ + product: 1115775000\n"); + + Ok(()) +} + -- cgit 1.4.1