Browse Source

fix: allow negative values in min and max arguments

pull/2/head
JuanLeon Lahoz 5 years ago
parent
commit
2e4d2da12b
  1. 2
      src/app.rs
  2. 16
      tests/integration_tests.rs

2
src/app.rs

@ -24,6 +24,7 @@ fn add_min_max(app: App) -> App {
Arg::new("max")
.long("max")
.short('M')
.allow_hyphen_values(true)
.about("Filter out values bigger than this")
.takes_value(true),
)
@ -31,6 +32,7 @@ fn add_min_max(app: App) -> App {
Arg::new("min")
.long("min")
.short('m')
.allow_hyphen_values(true)
.about("Filter out values smaller than this")
.takes_value(true),
)

16
tests/integration_tests.rs

@ -166,3 +166,19 @@ fn test_plot() {
Err(_) => assert!(false, "Could not create temp file"),
}
}
#[test]
fn test_hist_negative_min() {
let mut cmd = Command::cargo_bin("lowcharts").unwrap();
cmd.arg("hist")
.arg("--min")
.arg("-1")
.arg("--max")
.arg("10.1")
.write_stdin("4.2\n2.4\n-2\n")
.assert()
.success()
.stdout(predicate::str::contains(
"Samples = 2; Min = 2.4; Max = 4.2",
));
}

Loading…
Cancel
Save