summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorClementTsang <cjhtsang@uwaterloo.ca>2020-02-29 17:07:47 -0500
committerClementTsang <cjhtsang@uwaterloo.ca>2020-03-02 00:09:45 -0500
commit4c98fe4fde4aaa96ecbbd95afdb8a7338a9e3869 (patch)
treedb183fc5d58b8986d8f9fbb1e08e25808cf594e4 /tests
parenteb2622467fb05014dc52bf7ca077b3f7d57c47d9 (diff)
Refactoring.
Diffstat (limited to 'tests')
-rw-r--r--tests/arg_rate_tests.rs84
1 files changed, 42 insertions, 42 deletions
diff --git a/tests/arg_rate_tests.rs b/tests/arg_rate_tests.rs
index 35afb4d2..af43f217 100644
--- a/tests/arg_rate_tests.rs
+++ b/tests/arg_rate_tests.rs
@@ -10,64 +10,64 @@ use predicates::prelude::*;
//======================RATES======================//
fn get_os_binary_loc() -> String {
- if cfg!(target_os = "linux") {
- "./target/x86_64-unknown-linux-gnu/debug/btm".to_string()
- } else if cfg!(target_os = "windows") {
- "./target/x86_64-pc-windows-msvc/debug/btm".to_string()
- } else if cfg!(target_os = "macos") {
- "./target/x86_64-apple-darwin/debug/btm".to_string()
- } else {
- "".to_string()
- }
+ if cfg!(target_os = "linux") {
+ "./target/x86_64-unknown-linux-gnu/debug/btm".to_string()
+ } else if cfg!(target_os = "windows") {
+ "./target/x86_64-pc-windows-msvc/debug/btm".to_string()
+ } else if cfg!(target_os = "macos") {
+ "./target/x86_64-apple-darwin/debug/btm".to_string()
+ } else {
+ "".to_string()
+ }
}
#[test]
fn test_small_rate() -> Result<(), Box<dyn std::error::Error>> {
- Command::new(get_os_binary_loc())
- .arg("-r")
- .arg("249")
- .assert()
- .failure()
- .stderr(predicate::str::contains("rate to be greater than 250"));
- Ok(())
+ Command::new(get_os_binary_loc())
+ .arg("-r")
+ .arg("249")
+ .assert()
+ .failure()
+ .stderr(predicate::str::contains("rate to be greater than 250"));
+ Ok(())
}
#[test]
fn test_large_rate() -> Result<(), Box<dyn std::error::Error>> {
- Command::new(get_os_binary_loc())
- .arg("-r")
- .arg("18446744073709551616")
- .assert()
- .failure()
- .stderr(predicate::str::contains(
- "rate to be less than unsigned INT_MAX.",
- ));
- Ok(())
+ Command::new(get_os_binary_loc())
+ .arg("-r")
+ .arg("18446744073709551616")
+ .assert()
+ .failure()
+ .stderr(predicate::str::contains(
+ "rate to be less than unsigned INT_MAX.",
+ ));
+ Ok(())
}
#[test]
fn test_negative_rate() -> Result<(), Box<dyn std::error::Error>> {
- // This test should auto fail due to how clap works
- Command::new(get_os_binary_loc())
- .arg("-r")
- .arg("-1000")
- .assert()
- .failure()
- .stderr(predicate::str::contains(
- "wasn't expected, or isn't valid in this context",
- ));
+ // This test should auto fail due to how clap works
+ Command::new(get_os_binary_loc())
+ .arg("-r")
+ .arg("-1000")
+ .assert()
+ .failure()
+ .stderr(predicate::str::contains(
+ "wasn't expected, or isn't valid in this context",
+ ));
- Ok(())
+ Ok(())
}
#[test]
fn test_invalid_rate() -> Result<(), Box<dyn std::error::Error>> {
- Command::new(get_os_binary_loc())
- .arg("-r")
- .arg("100-1000")
- .assert()
- .failure()
- .stderr(predicate::str::contains("invalid digit"));
+ Command::new(get_os_binary_loc())
+ .arg("-r")
+ .arg("100-1000")
+ .assert()
+ .failure()
+ .stderr(predicate::str::contains("invalid digit"));
- Ok(())
+ Ok(())
}