1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
pub mod common;
#[macro_export]
macro_rules! testcase {
($name:ident, $($pairhmm_mode:ident),+) => {
paste! {
lazy_static! {
static ref [<$name:upper _MUTEX>]: Mutex<()> = Mutex::new(());
}
$(
#[test]
fn [<$name _ $pairhmm_mode _mode>]() {
use crate::testcase::runner::common::load_testcase;
// Poison error can be ignored here, because it just means that the other test failed
// and we are safe to go on.
let _guard = [<$name:upper _MUTEX>].lock();
let name = stringify!($name);
let testcase = load_testcase(
&Path::new(file!())
.parent()
.unwrap()
.join("resources/testcases")
.join(name),
)
.unwrap();
let mode = stringify!($pairhmm_mode);
// setup logger
// fern::Dispatch::new()
// .level(log::LevelFilter::Info)
// .chain(std::io::stderr())
// .apply()
// .unwrap();
testcase.run(mode).unwrap();
testcase.check();
}
)*
}
};
}
#[macro_export]
macro_rules! testcase_should_panic {
($name:ident, $($pairhmm_mode:ident),+) => {
paste! {
lazy_static! {
static ref [<$name:upper _MUTEX>]: Mutex<()> = Mutex::new(());
}
$(
#[should_panic]
#[test]
fn [<$name _ $pairhmm_mode _mode>]() {
use crate::testcase::runner::common::load_testcase;
// Poison error can be ignored here, because it just means that the other test failed
// and we are safe to go on.
let _guard = [<$name:upper _MUTEX>].lock();
let name = stringify!($name);
let testcase = load_testcase(
&Path::new(file!())
.parent()
.unwrap()
.join("resources/testcases")
.join(name),
)
.unwrap();
let mode = stringify!($pairhmm_mode);
testcase.run(mode).unwrap();
testcase.check();
}
)*
}
};
}
pub use testcase;
pub use testcase_should_panic;