better error messages when reading timeseries

This commit is contained in:
Daniel Bauer
2018-11-30 12:58:24 +01:00
parent 4aa3552f1d
commit c03be1723e
6 changed files with 73 additions and 6 deletions

View File

@@ -0,0 +1,11 @@
84.840004 -2.878293
84.860004 -2.827750
84.880004 -2.962375
84.900004
84.920004 -2.748589
84.940004 -2.726197
84.960004 -2.802982
84.980004 -2.771980
85.000004 -2.706482
85.020004 -2.776983
85.040004 -2.883180

View File

@@ -0,0 +1,11 @@
84.840004 -2.878293
84.860004 -2.827750
84.880004 -2.962375
84.900004 qwee
84.920004 -2.748589
84.940004 -2.726197
84.960004 -2.802982
84.980004 -2.771980
85.000004 -2.706482
85.020004 -2.776983
85.040004 -2.883180

View File

@@ -77,6 +77,36 @@ mod integration {
));
}
#[test]
fn unparseable_timeseries() {
let output = Command::new("./target/debug/wham")
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
.args(&["-f", "tests/metadata_unparseable3.dat"])
.args(&["-o", "/dev/null"])
.output()
.expect("failed to execute process");
let output = String::from_utf8_lossy(&output.stderr);
println!("{}", output);
assert!(output.to_string().contains(
"Failed to parse line"
));
}
#[test]
fn unparseable_timeseries_empty() {
let output = Command::new("./target/debug/wham")
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
.args(&["-f", "tests/metadata_unparseable4.dat"])
.args(&["-o", "/dev/null"])
.output()
.expect("failed to execute process");
let output = String::from_utf8_lossy(&output.stderr);
println!("{}", output);
assert!(output.to_string().contains(
"Wrong number of columns in line"
));
}
#[test]
fn wham_1d() {;
Command::new("./target/debug/wham")

View File

@@ -0,0 +1 @@
COLVAR_unparseable_2.xvg -3.0 100

View File

@@ -0,0 +1 @@
COLVAR_unparseable_1.xvg -3.0 100