integration test for max iterations

This commit is contained in:
Daniel Bauer
2018-11-05 10:26:30 +01:00
parent 93cd0d1a71
commit 193ed89d5e

View File

@@ -7,7 +7,7 @@ mod integration {
use fs;
#[test]
fn calling_wham_without_args() {
fn no_args() {
let output = Command::new("./target/debug/wham")
.output()
.expect("failed to execute process");
@@ -17,7 +17,7 @@ mod integration {
}
#[test]
fn calling_wham_with_data_out_of_bonds() {
fn 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"])
@@ -32,7 +32,7 @@ mod integration {
}
#[test]
fn calling_wham_with_unparseable_bias_pos() {
fn 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"])
@@ -47,7 +47,7 @@ mod integration {
}
#[test]
fn calling_wham_with_unparseable_bias_fc() {
fn 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"])
@@ -62,7 +62,23 @@ mod integration {
}
#[test]
fn calling_wham_1d() {;
fn no_convergence() {
let output = Command::new("./target/debug/wham")
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
.args(&["--iterations", "10"])
.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(
"Error: WHAM not converged! (max iterations reached)"
));
}
#[test]
fn 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"])
@@ -82,7 +98,7 @@ mod integration {
#[test]
#[ignore] // expensive
fn calling_wham_2d() {;
fn 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_unparseable1.dat"])