mirror of
https://github.com/dnlbauer/WHAM.git
synced 2026-09-10 22:25:31 +00:00
improved I/O error messages
This commit is contained in:
@@ -16,11 +16,56 @@ mod integration {
|
||||
assert!(out.contains(expected_error));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn calling_wham_with_data_out_of_bonds() {
|
||||
let output = Command::new("./target/debug/wham")
|
||||
.args(&["--bins", "100", "--min", "2.0", "--max", "3.0", "-T", "300"])
|
||||
.args(&["-f", "example/1d/metadata.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(
|
||||
"No data points in histogram boundaries"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn calling_wham_with_unparseable_bias_pos() {
|
||||
let output = Command::new("./target/debug/wham")
|
||||
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
||||
.args(&["-f", "tests/metadata_unparseable1.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 read bias position in line 1"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn calling_wham_with_unparseable_bias_fc() {
|
||||
let output = Command::new("./target/debug/wham")
|
||||
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
||||
.args(&["-f", "tests/metadata_unparseable2.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 read bias fc in line 1"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn calling_wham_1d() {;
|
||||
Command::new("./target/debug/wham")
|
||||
.args(&["--bins", "100", "--max", "3.14", "--min", "-3.14", "-T", "300", "--cyclic"])
|
||||
.args(&["-f", "example/1d/metadata.dat"])
|
||||
.args(&["-f", "example/1d/metadata_unparseable1.dat"])
|
||||
.args(&["-o", "/tmp/wham_test_1d.out"])
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
@@ -40,7 +85,7 @@ mod integration {
|
||||
fn calling_wham_2d() {;
|
||||
Command::new("./target/debug/wham")
|
||||
.args(&["--bins", "100,100", "--max", "3.14,3.14", "--min", "-3.14,-3.14", "-T", "300", "--cyclic"])
|
||||
.args(&["-f", "example/2d/metadata.dat"])
|
||||
.args(&["-f", "example/2d/metadata_unparseable1.dat"])
|
||||
.args(&["-o", "/tmp/wham_test_2d.out"])
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
|
||||
25
tests/metadata_unparseable1.dat
Normal file
25
tests/metadata_unparseable1.dat
Normal file
@@ -0,0 +1,25 @@
|
||||
../example/1d/COLVAR+0.0.xvg qwert 100
|
||||
../example/1d/COLVAR+0.25.xvg 0.25 100
|
||||
../example/1d/COLVAR+0.5.xvg 0.5 100
|
||||
../example/1d/COLVAR+0.75.xvg 0.75 100
|
||||
../example/1d/COLVAR+1.0.xvg 1.0 100
|
||||
../example/1d/COLVAR+1.25.xvg 1.25 100
|
||||
../example/1d/COLVAR+1.5.xvg 1.5 100
|
||||
../example/1d/COLVAR+1.75.xvg 1.75 100
|
||||
../example/1d/COLVAR+2.0.xvg 2.0 100
|
||||
../example/1d/COLVAR+2.25.xvg 2.25 100
|
||||
../example/1d/COLVAR+2.5.xvg 2.5 100
|
||||
../example/1d/COLVAR+2.75.xvg 2.75 100
|
||||
../example/1d/COLVAR+3.0.xvg 3.0 100
|
||||
../example/1d/COLVAR-0.25.xvg -0.25 100
|
||||
../example/1d/COLVAR-0.5.xvg -0.5 100
|
||||
../example/1d/COLVAR-0.75.xvg -0.75 100
|
||||
../example/1d/COLVAR-1.0.xvg -1.0 100
|
||||
../example/1d/COLVAR-1.25.xvg -1.25 100
|
||||
../example/1d/COLVAR-1.5.xvg -1.5 100
|
||||
../example/1d/COLVAR-1.75.xvg -1.75 100
|
||||
../example/1d/COLVAR-2.0.xvg -2.0 100
|
||||
../example/1d/COLVAR-2.25.xvg -2.25 100
|
||||
../example/1d/COLVAR-2.5.xvg -2.5 100
|
||||
../example/1d/COLVAR-2.75.xvg -2.75 100
|
||||
../example/1d/COLVAR-3.0.xvg -3.0 100
|
||||
25
tests/metadata_unparseable2.dat
Normal file
25
tests/metadata_unparseable2.dat
Normal file
@@ -0,0 +1,25 @@
|
||||
../example/1d/COLVAR+0.0.xvg 0.0 qwert
|
||||
../example/1d/COLVAR+0.25.xvg 0.25 100
|
||||
../example/1d/COLVAR+0.5.xvg 0.5 100
|
||||
../example/1d/COLVAR+0.75.xvg 0.75 100
|
||||
../example/1d/COLVAR+1.0.xvg 1.0 100
|
||||
../example/1d/COLVAR+1.25.xvg 1.25 100
|
||||
../example/1d/COLVAR+1.5.xvg 1.5 100
|
||||
../example/1d/COLVAR+1.75.xvg 1.75 100
|
||||
../example/1d/COLVAR+2.0.xvg 2.0 100
|
||||
../example/1d/COLVAR+2.25.xvg 2.25 100
|
||||
../example/1d/COLVAR+2.5.xvg 2.5 100
|
||||
../example/1d/COLVAR+2.75.xvg 2.75 100
|
||||
../example/1d/COLVAR+3.0.xvg 3.0 100
|
||||
../example/1d/COLVAR-0.25.xvg -0.25 100
|
||||
../example/1d/COLVAR-0.5.xvg -0.5 100
|
||||
../example/1d/COLVAR-0.75.xvg -0.75 100
|
||||
../example/1d/COLVAR-1.0.xvg -1.0 100
|
||||
../example/1d/COLVAR-1.25.xvg -1.25 100
|
||||
../example/1d/COLVAR-1.5.xvg -1.5 100
|
||||
../example/1d/COLVAR-1.75.xvg -1.75 100
|
||||
../example/1d/COLVAR-2.0.xvg -2.0 100
|
||||
../example/1d/COLVAR-2.25.xvg -2.25 100
|
||||
../example/1d/COLVAR-2.5.xvg -2.5 100
|
||||
../example/1d/COLVAR-2.75.xvg -2.75 100
|
||||
../example/1d/COLVAR-3.0.xvg -3.0 100
|
||||
Reference in New Issue
Block a user