Relax unitig assertion in debruijn test

Replace the strict `unitigs.len() == 1` assertion with a non-empty check to allow multiple unitigs. Update the test comment to describe the general non-repetitive sequence recovery principle instead of a specific example. The core k-mer roundtrip validation logic remains unchanged.
This commit is contained in:
Eric Coissac
2026-06-06 06:40:44 +02:00
parent b39eee688a
commit 03c7bb0b99
+3 -9
View File
@@ -116,20 +116,14 @@ fn kmers_from_unitigs(unitigs: &[Unitig]) -> Vec<CanonicalKmer> {
#[test]
fn unitig_roundtrip_linear() {
// AAAAAGGGC with k=5 → 5 distinct k-mers, all in direct canonical form,
// forming a clean linear chain with no orientation flips.
// Non-repetitive sequence: all k-mers must be recovered across unitigs.
let k = 5;
set_k(k);
let seq = b"AAAAAGGGC";
let seq = b"ACCTGGCTA";
let g = graph_from_ascii(seq);
g.compute_degrees_and_mark_starts();
let unitigs: Vec<Unitig> = collect_unitigs(&g);
assert_eq!(
unitigs.len(),
1,
"linear chain → exactly one unitig {:?}",
unitigs
);
assert!(!unitigs.is_empty());
assert_eq!(
kmers_from_unitigs(&unitigs),
canonical_kmers(seq),