diff --git a/tests/coverage.rs b/tests/coverage.rs index fdbc3ee..c62b56b 100644 --- a/tests/coverage.rs +++ b/tests/coverage.rs @@ -55,6 +55,51 @@ mod testing { Ok(()) } + #[test] + fn test_coverage_mt() -> Result<()> { + let a = "tests/datasets/coverage/coverage_a.bed"; + let b = "tests/datasets/coverage/coverage_b.bed"; + + let mut cmd = Command::cargo_bin("gia")?; + let output = cmd + .arg("coverage") + .arg("-a") + .arg(a) + .arg("-b") + .arg(b) + .arg("-@") + .arg("4") + .output()?; + println!("{:?}", output); + let num_intervals = output.stdout.split(|&c| c == b'\n').count() - 1; + assert_eq!(num_intervals, 10); + + let num_fields = output + .stdout + .split(|&c| c == b'\n') + .next() + .unwrap() + .split(|&c| c == b'\t') + .count(); + assert_eq!(num_fields, 4); + + let expected = vec![ + (1, 72, 222, 4), + (1, 257, 407, 1), + (1, 268, 418, 1), + (1, 467, 617, 1), + (1, 819, 969, 1), + (2, 174, 324, 2), + (2, 587, 737, 1), + (3, 395, 545, 0), + (3, 554, 704, 0), + (3, 653, 803, 0), + ]; + let expected_str = build_expected_str(&expected); + assert_eq!(output.stdout, expected_str.as_bytes()); + Ok(()) + } + #[test] fn test_coverage_bed3_bed3() -> Result<()> { let a = "tests/datasets/coverage/coverage_a.bed";