diff options
author | ClementTsang <clementjhtsang@gmail.com> | 2019-09-14 21:48:29 -0400 |
---|---|---|
committer | ClementTsang <clementjhtsang@gmail.com> | 2019-09-14 21:48:29 -0400 |
commit | 48461756380e11533173eb1688e97203575687dd (patch) | |
tree | 0c7f6bdab94c29e43f553905416a2b657478896b /tests | |
parent | b75374be76047b60b2be49ed2789e633a7570a1c (diff) |
Added error util, finished network graph.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arg_tests.rs | 40 | ||||
-rw-r--r-- | tests/basic_tests.rs | 0 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/arg_tests.rs b/tests/arg_tests.rs new file mode 100644 index 00000000..978b24c6 --- /dev/null +++ b/tests/arg_tests.rs @@ -0,0 +1,40 @@ +use std::process::Command; // Run programs +use assert_cmd::prelude::*; // Add methods on commands +use predicates::prelude::*; // Used for writing assertions + +#[test] +fn test_small_rate -> Result<(), Box<std::error::Error>> { + let mut cmd = Command::main_binary()?; + cmd.arg("-r") + .arg("249"); + cmd.assert() + .failure() + .stderr(predicate::str::contains("rate")); + + Ok(()) +} + +#[test] +fn test_negative_rate -> Result<(), Box<std::error::Error>> { + // This test should auto fail due to how clap works + let mut cmd = Command::main_binary()?; + cmd.arg("-r") + .arg("-1000"); + cmd.assert() + .failure() + .stderr(predicate::str::contains("valid")); + + Ok(()) +} + +#[test] +fn test_invalid_rate -> Result<(), Box<std::error::Error>> { + let mut cmd = Command::main_binary()?; + cmd.arg("-r") + .arg("1000 - 100"); + cmd.assert() + .failure() + .stderr(predicate::str::contains("digit")); + + Ok(()) +}
\ No newline at end of file diff --git a/tests/basic_tests.rs b/tests/basic_tests.rs deleted file mode 100644 index e69de29b..00000000 --- a/tests/basic_tests.rs +++ /dev/null |