add pi to min/max

This commit is contained in:
Daniel Bauer
2020-03-08 11:42:47 +01:00
parent cd7bea063f
commit 936cbe1c58
11 changed files with 10352 additions and 10306 deletions

View File

@@ -1,14 +1,14 @@
use std::process::Command;
use std::fs;
mod command;
#[cfg(test)]
mod integration {
use Command;
use fs;
use std::process::Command;
use super::command::get_command;
#[test]
fn no_args() {
let output = Command::new("./target/debug/wham")
let output = get_command()
.output()
.expect("failed to execute process");
let expected_error = "The following required arguments were not provided";
@@ -18,7 +18,7 @@ mod integration {
#[test]
fn unparseable_bias_pos() {
let output = Command::new("./target/debug/wham")
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"])
@@ -33,7 +33,7 @@ mod integration {
#[test]
fn unparseable_bias_fc() {
let output = Command::new("./target/debug/wham")
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"])
@@ -48,7 +48,7 @@ mod integration {
#[test]
fn no_convergence() {
let output = Command::new("./target/debug/wham")
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"])
@@ -64,7 +64,7 @@ mod integration {
#[test]
fn unparseable_timeseries() {
let output = Command::new("./target/debug/wham")
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"])
@@ -79,7 +79,7 @@ mod integration {
#[test]
fn unparseable_timeseries_empty() {
let output = Command::new("./target/debug/wham")
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"])
@@ -94,7 +94,7 @@ mod integration {
#[test]
fn skip_rows() {
let output = Command::new("./target/debug/wham")
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"])

13
tests/command.rs Normal file
View File

@@ -0,0 +1,13 @@
use std::process::Command;
use std::env;
pub fn get_command() -> Command {
let exe = env::current_exe().unwrap();
let path = exe.to_str().unwrap();
let cmd = if path.contains("release") {
"./target/release/wham"
} else {
"./target/debug/wham"
};
Command::new(cmd)
}

View File

@@ -1,14 +1,15 @@
use std::process::Command;
use std::fs;
mod command;
#[cfg(test)]
mod integration {
use Command;
use fs;
use std::process::Command;
use std::fs;
use super::command::get_command;
#[test]
fn wham_1d() {
Command::new("./target/debug/wham")
get_command()
.args(&["--bins", "100", "--max", "4.5", "--min", "0.7", "-T", "310"])
.args(&["-f", "example/1d/metadata.dat"])
.args(&["-o", "/tmp/wham_test_1d.out"])
@@ -27,8 +28,8 @@ mod integration {
#[test]
fn wham_1d_cyclic() {
Command::new("./target/debug/wham")
.args(&["--bins", "100", "--max", "3.14", "--min", "-3.14", "-T", "300", "--cyclic"])
get_command()
.args(&["--bins", "100", "--max", "pi", "--min", "-pi", "-T", "300", "--cyclic"])
.args(&["-f", "example/1d_cyclic/metadata.dat"])
.args(&["-o", "/tmp/wham_test_1d_cyclic.out"])
.output()
@@ -47,8 +48,8 @@ mod integration {
#[test]
#[ignore] // expensive
fn wham_2d_cyclic() {
Command::new("./target/debug/wham")
.args(&["--bins", "100,100", "--max", "3.14,3.14", "--min", "-3.14,-3.14", "-T", "300", "--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()