Skip to content

Commit

Permalink
test contains_harf_muqottoah function
Browse files Browse the repository at this point in the history
  • Loading branch information
alpancs committed Sep 24, 2024
1 parent f523c7a commit da3eb41
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions quranize/src/suffix_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ fn contains_harf_muqottoah(i: Index) -> bool {
#[cfg(test)]
mod tests {
use super::*;
use crate::transliteration::harf_muqottoah_map;
use crate::{Quranize, AYA_COUNT};
use pretty_assertions::assert_eq;

#[test]
Expand All @@ -118,4 +120,17 @@ mod tests {
assert_eq!(SuffixTree::longest_prefix("a", "ay"), Some("a"));
assert_eq!(SuffixTree::longest_prefix("ax", "ay"), Some("a"));
}

#[test]
fn test_contains_harf_muqottoah() {
let q = Quranize::new();
(0..AYA_COUNT)
.filter(|&i| contains_harf_muqottoah((i, 0)))
.for_each(|i| {
let (s, a, q) = q.saqs[i];
let q = q.split_whitespace().next().unwrap();
let all_chars_is_muq = q.chars().all(|c| !harf_muqottoah_map(c).is_empty());
assert!(all_chars_is_muq, "i={}, {}:{} => {}", i, s, a, q);
});
}
}

0 comments on commit da3eb41

Please sign in to comment.