Skip to content

Commit

Permalink
add a containment test
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Mar 5, 2022
1 parent 39fb8f0 commit 1c363da
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/src/sketch/nodegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,24 @@ mod test {
assert_eq!(ng.unique_kmers(), 1);
}

#[test]
fn containment() {
let mut ng1: Nodegraph = Nodegraph::new(&[31], 3);
let mut ng2: Nodegraph = Nodegraph::new(&[31], 3);

(0..20).for_each(|i| {
if i % 2 == 0 {
ng1.count(i);
};
ng2.count(i);
});

assert_eq!(ng1.containment(&ng2), 1.0);
assert_eq!(ng1.similarity(&ng2), 0.5);
assert_eq!(ng1.unique_kmers(), 10);
assert_eq!(ng2.unique_kmers(), 20);
}

#[test]
fn load_save_nodegraph() {
let mut datadir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
Expand Down

0 comments on commit 1c363da

Please sign in to comment.