mirror of
https://github.com/dnlbauer/WHAM.git
synced 2026-09-10 22:25:31 +00:00
commit 07e5a0a1a5cef7b99ac8602fa39226ddce175b67 Author: Daniel Bauer <bauer@cbs.tu-darmstadt.de> Date: Thu Jul 22 12:48:35 2021 +0200 version up commit 4c58f5a42c091a480473809f8fdb5c4f361b8883 Author: Daniel Bauer <bauer@cbs.tu-darmstadt.de> Date: Thu Jul 22 12:22:01 2021 +0200 test convdt needs start/end commit fad1c0c4fca3cffe91db32c7e4d91139a6513a9f Author: Daniel Bauer <bauer@cbs.tu-darmstadt.de> Date: Thu Jul 22 12:14:21 2021 +0200 unit test for empty timeseries commit cdf520aad6e70ea22d96363d28c1110d3d5bc3e0 Author: Daniel Bauer <bauer@cbs.tu-darmstadt.de> Date: Thu Jul 22 11:51:12 2021 +0200 refractored convdt slices; fix issue with incomplete convdt slices commit 5b33d9cb61b59ead4a22f03ae3981175feb25770 Author: Daniel Bauer <bauer@cbs.tu-darmstadt.de> Date: Thu Jul 22 10:37:13 2021 +0200 test dataset for convdt commit 023bba0a0d46929b3ea4c2ede075b851deb7b779 Author: Daniel Bauer <bauer@cbs.tu-darmstadt.de> Date: Thu Jul 22 10:36:45 2021 +0200 force --start and --end with --convdt
127 lines
4.3 KiB
Rust
127 lines
4.3 KiB
Rust
mod command;
|
|
|
|
#[cfg(test)]
|
|
mod integration {
|
|
use super::command::get_command;
|
|
|
|
#[test]
|
|
fn no_args() {
|
|
let output = get_command()
|
|
.output()
|
|
.expect("failed to execute process");
|
|
let expected_error = "The following required arguments were not provided";
|
|
let out = String::from_utf8_lossy(&output.stderr);
|
|
assert!(out.contains(expected_error));
|
|
}
|
|
|
|
#[test]
|
|
fn unparseable_bias_pos() {
|
|
let output = get_command()
|
|
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
|
.args(&["-f", "tests/data/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 unparseable_bias_fc() {
|
|
let output = get_command()
|
|
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
|
.args(&["-f", "tests/data/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 no_convergence() {
|
|
let output = get_command()
|
|
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
|
.args(&["--iterations", "10"])
|
|
.args(&["-f", "example/1d_cyclic/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 unparseable_timeseries() {
|
|
let output = get_command()
|
|
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
|
.args(&["-f", "tests/data/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 = get_command()
|
|
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
|
.args(&["-f", "tests/data/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 skip_rows() {
|
|
let output = get_command()
|
|
.args(&["--bins", "100", "--max", "3.14", "--min", "-3.14", "-T", "300", "--cyclic"])
|
|
.args(&["-f", "example/1d_cyclic/metadata.dat"])
|
|
.args(&["-o", "/tmp/wham_test_1d_cyclic.out"])
|
|
.args(&["--start", "50", "--end", "60"])
|
|
.args(&["-v"])
|
|
.output()
|
|
.expect("failed to execute process");
|
|
|
|
let output = String::from_utf8_lossy(&output.stdout);
|
|
println!("{}", output);
|
|
assert!(output.to_string().contains(
|
|
"25 windows, 12489 datapoints"
|
|
));
|
|
}
|
|
|
|
#[test]
|
|
fn convdt_needs_start_end() {
|
|
let output = get_command()
|
|
.args(&["--bins", "100", "--min", "-3.0", "--max", "3.0", "-T", "300"])
|
|
.args(&["-f", "tests/data/metadata_unparseable1.dat"])
|
|
.args(&["-o", "/dev/null"])
|
|
.args(&["--convdt", "100"])
|
|
.output()
|
|
.expect("failed to execute process");
|
|
let output = String::from_utf8_lossy(&output.stderr);
|
|
println!("{}", output);
|
|
assert!(output.to_string().contains(
|
|
"--convdt requires --start and --end to be set"
|
|
));
|
|
}
|
|
|
|
} |