Skip to content

Commit

Permalink
add KmerMinHashBTree test
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Oct 12, 2024
1 parent b47a6c4 commit 62f03eb
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/core/tests/minhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,30 @@ fn test_n_unique_kmers() {
}

#[test]
fn test_scaled_downsampling() {
fn test_scaled_downsampling_kmerminhash() {
let mh = KmerMinHash::new(10, 21, HashFunctions::Murmur64Dna, 42, true, 0);

// downsampling to same scaled is OK:
let new_mh = mh.clone().downsample_scaled(10).unwrap();
assert_eq!(new_mh.scaled(), 10);

// downsampling is OK:
let new_mh = mh.clone().downsample_scaled(100).unwrap();
assert_eq!(new_mh.scaled(), 100);

// upsampling not ok
let e = mh.clone().downsample_scaled(1).unwrap_err();
assert!(matches!(e, sourmash::Error::CannotUpsampleScaled));
}

#[test]
fn test_scaled_downsampling_kmerminhashbtree() {
let mh = KmerMinHashBTree::new(10, 21, HashFunctions::Murmur64Dna, 42, true, 0);

// downsampling to same scaled is OK:
let new_mh = mh.clone().downsample_scaled(10).unwrap();
assert_eq!(new_mh.scaled(), 10);

// downsampling is OK:
let new_mh = mh.clone().downsample_scaled(100).unwrap();
assert_eq!(new_mh.scaled(), 100);
Expand Down

0 comments on commit 62f03eb

Please sign in to comment.