use assert_cmd::Command;
const EX_DIR: &str = "./target/debug/examples/";
fn remove_whitespace(s: &str) -> String {
s.chars().filter(|c| !c.is_whitespace()).collect()
}
fn compare_strings(a: &str, b: &str) {
let a = remove_whitespace(a);
let b = remove_whitespace(b);
assert_eq!(a, b);
}
#[test]
fn ccsd_t1_21_ttgt_all_opts() {
let output = Command::new(EX_DIR.to_owned() + "ccsd_t1_21_ttgt_all_opts").unwrap();
compare_strings(
&String::from_utf8_lossy(&output.stdout),
"
data =
32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,32030.7,
",
);
}
#[test]
fn ccsd_t1_21_ttgt() {
let output = Command::new(EX_DIR.to_owned() + "ccsd_t1_21_ttgt").unwrap();
compare_strings(
&String::from_utf8_lossy(&output.stdout),
"
data =
250.24,250.24,250.24,250.24,250.24,250.24,250.24,250.24,
",
);
}
#[test]
fn ccsd_t1_21_ttgt_tiling() {
let output = Command::new(EX_DIR.to_owned() + "ccsd_t1_21_ttgt_tiling").unwrap();
compare_strings(
&String::from_utf8_lossy(&output.stdout),
"
data =
250.24,250.24,250.24,250.24,250.24,250.24,250.24,250.24,
",
);
}
#[test]
fn ccsd_t1_3_ttgt() {
let output = Command::new(EX_DIR.to_owned() + "ccsd_t1_3_ttgt").unwrap();
compare_strings(
&String::from_utf8_lossy(&output.stdout),
"
data =
15.64,15.64,15.64,15.64,15.64,15.64,15.64,15.64,
",
);
}
#[test]
fn ccsd_t1_4_ttgt_bestperm() {
let output = Command::new(EX_DIR.to_owned() + "ccsd_t1_4_ttgt_bestperm").unwrap();
compare_strings(
&String::from_utf8_lossy(&output.stdout),
"
data =
62.56,62.56,62.56,62.56,62.56,62.56,62.56,62.56,
",
);
}
#[test]
fn ccsd_t1_4_ttgt() {
let output = Command::new(EX_DIR.to_owned() + "ccsd_t1_4_ttgt").unwrap();
compare_strings(
&String::from_utf8_lossy(&output.stdout),
"
data =
62.56,62.56,62.56,62.56,62.56,62.56,62.56,62.56,
",
);
}
#[test]
fn opt_dense_transpose() {
let output = Command::new(EX_DIR.to_owned() + "opt_dense_transpose").unwrap();
compare_strings(&String::from_utf8_lossy(&output.stdout),"
data =
3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3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.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,3.7,
");
}
#[test]
fn spgemm_w_compressed_workspace() {
let output = Command::new(EX_DIR.to_owned() + "spgemm_w_compressed_workspace").unwrap();
compare_strings(
&String::from_utf8_lossy(&output.stdout),
"
data =
5,
data =
0,
data =
0,2,4,5,7,9,
data =
0,3,1,4,2,0,3,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
data =
6.74,7,17,17.5,9,20.5,21.74,36.4,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
",
);
}