Skip to content

Commit

Permalink
init cargo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WardDeb committed Jan 20, 2025
1 parent 64397a6 commit 9c4bfcc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ mod alignmentsieve;
mod filehandler;
mod normalization;
mod calc;
mod multibamsummary;
mod test;

#[pymodule]
fn hp(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(bamcoverage::r_bamcoverage, m)?)?;
m.add_function(wrap_pyfunction!(bamcompare::r_bamcompare, m)?)?;
m.add_function(wrap_pyfunction!(computematrix::r_computematrix, m)?)?;
m.add_function(wrap_pyfunction!(alignmentsieve::r_alignmentsieve, m)?)?;
m.add_function(wrap_pyfunction!(multibamsummary::r_mbams, m)?)?;
Ok(())
}
12 changes: 12 additions & 0 deletions src/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use crate::calc::median;

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_median() {
let v: Vec<u32> = vec![1,2,3,4,5];
assert_eq!(median(v), 3.0);
}
}

0 comments on commit 9c4bfcc

Please sign in to comment.