Skip to content

Commit

Permalink
add some tests for SuffixTree
Browse files Browse the repository at this point in the history
  • Loading branch information
alpancs committed Sep 21, 2024
1 parent 3ad4f1e commit b3c310f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions quranize/src/suffix_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ mod tests {
use super::*;
use pretty_assertions::assert_eq;

#[test]
fn test_suffix_tree() {
let s = include_str!("quran-uthmani-min.txt");
let t = SuffixTree::new(&s[..(s.find("\n\n").unwrap() + 2)]);
assert_eq!(t.vertices.len() - t.edges.len(), 1);
assert_eq!(t.vertices.len(), 123_014);
assert_eq!(t.collect_data(0).len(), 77_883);
}

#[test]
fn test_longest_prefix() {
assert_eq!(SuffixTree::longest_prefix("", ""), None);
Expand Down

0 comments on commit b3c310f

Please sign in to comment.