Files
WHAM/tests/examples.rs
Daniel Bauer 2cc34919b0 Autocorrelation (#2)
* calculate autocorrelation stats_ineff and tau
* uncorr flag
* read timeseries into vector
* uncorrelate data
* README
* Update README.md
* Update README.md

Co-authored-by: Daniel Bauer <bauer@cbs.tu-darmstadt.de>
2020-10-25 22:40:13 +01:00

69 lines
2.4 KiB
Rust

mod command;
#[cfg(test)]
mod integration {
use std::process::Command;
use std::fs;
use super::command::get_command;
#[test]
fn wham_1d_cyclic() {
get_command()
.args(&["--bins", "100", "--max", "pi", "--min", "-pi", "-T", "300", "--cyclic"])
.args(&["--bt", "100", "--seed", "1234"])
.args(&["-f", "example/1d_cyclic/metadata.dat"])
.args(&["-o", "/tmp/wham_test_1d_cyclic.out"])
.output()
.expect("failed to execute process");
assert!(fs::metadata("/tmp/wham_test_1d_cyclic.out").is_ok());
let output = Command::new("diff")
.arg("/tmp/wham_test_1d_cyclic.out")
.arg("example/1d_cyclic/wham.out")
.output()
.expect("failed to run diff");
let output_len = String::from_utf8_lossy(&output.stdout).len();
assert_eq!(output_len, 0);
}
#[test]
fn wham_1d_cyclic_uncorrelated() {
get_command()
.args(&["--bins", "100", "--max", "pi", "--min", "-pi", "-T", "300", "--cyclic", "--uncorr"])
.args(&["--seed", "1234"])
.args(&["-f", "example/1d_cyclic/metadata.dat"])
.args(&["-o", "/tmp/wham_test_1d_cyclic.out"])
.output()
.expect("failed to execute process");
assert!(fs::metadata("/tmp/wham_test_1d_cyclic.out").is_ok());
let output = Command::new("diff")
.arg("/tmp/wham_test_1d_cyclic.out")
.arg("example/1d_cyclic/wham_uncorrelated.out")
.output()
.expect("failed to run diff");
let output_len = String::from_utf8_lossy(&output.stdout).len();
assert_eq!(output_len, 0);
}
#[test]
#[ignore] // expensive
fn wham_2d_cyclic() {
get_command()
.args(&["--bins", "100,100", "--max", "pi,pi", "--min", "-pi,-pi", "-T", "300", "--cyclic"])
.args(&["-f", "example/2d_cyclic/metadata.dat"])
.args(&["-o", "/tmp/wham_test_2d_cyclic.out"])
.output()
.expect("failed to execute process");
assert!(fs::metadata("/tmp/wham_test_2d_cyclic.out").is_ok());
let output = Command::new("diff")
.arg("/tmp/wham_test_2d_cyclic.out")
.arg("example/2d_cyclic/wham.out")
.output()
.expect("failed to run diff");
let output_len = String::from_utf8_lossy(&output.stdout).len();
assert_eq!(output_len, 0);
}
}