Skip to content

Commit

Permalink
adapt tests to pass text not as reference
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonVandeVyver committed Oct 25, 2024
1 parent 0fc7431 commit bfd9069
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sa-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,42 +175,42 @@ mod tests {
#[test]
fn test_build_ssa_libsais() {
let mut text = b"ABRACADABRA$".to_vec();
let sa = build_ssa(&mut text, &SAConstructionAlgorithm::LibSais, 1).unwrap();
let sa = build_ssa(text, &SAConstructionAlgorithm::LibSais, 1).unwrap();
assert_eq!(sa, vec![11, 10, 7, 0, 3, 5, 8, 1, 4, 6, 9, 2]);
}

#[test]
fn test_build_ssa_libsais_empty() {
let mut text = b"".to_vec();
let sa = build_ssa(&mut text, &SAConstructionAlgorithm::LibSais, 1).unwrap();
let sa = build_ssa(text, &SAConstructionAlgorithm::LibSais, 1).unwrap();
assert_eq!(sa, vec![]);
}

#[test]
fn test_build_ssa_libsais_sparse() {
let mut text = b"ABRACADABRA$".to_vec();
let sa = build_ssa(&mut text, &SAConstructionAlgorithm::LibSais, 2).unwrap();
let sa = build_ssa(text, &SAConstructionAlgorithm::LibSais, 2).unwrap();
assert_eq!(sa, vec![10, 0, 8, 4, 6, 2]);
}

#[test]
fn test_build_ssa_libdivsufsort() {
let mut text = b"ABRACADABRA$".to_vec();
let sa = build_ssa(&mut text, &SAConstructionAlgorithm::LibDivSufSort, 1).unwrap();
let sa = build_ssa(text, &SAConstructionAlgorithm::LibDivSufSort, 1).unwrap();
assert_eq!(sa, vec![11, 10, 7, 0, 3, 5, 8, 1, 4, 6, 9, 2]);
}

#[test]
fn test_build_ssa_libdivsufsort_empty() {
let mut text = b"".to_vec();
let sa = build_ssa(&mut text, &SAConstructionAlgorithm::LibDivSufSort, 1).unwrap();
let sa = build_ssa(text, &SAConstructionAlgorithm::LibDivSufSort, 1).unwrap();
assert_eq!(sa, vec![]);
}

#[test]
fn test_build_ssa_libdivsufsort_sparse() {
let mut text = b"ABRACADABRA$".to_vec();
let sa = build_ssa(&mut text, &SAConstructionAlgorithm::LibDivSufSort, 2).unwrap();
let sa = build_ssa(text, &SAConstructionAlgorithm::LibDivSufSort, 2).unwrap();
assert_eq!(sa, vec![10, 0, 8, 4, 6, 2]);
}

Expand Down

0 comments on commit bfd9069

Please sign in to comment.