use symspellrs::{include_dictionary, Verbosity};
#[test]
fn test_include_macro_basic_lookup() {
let sym = include_dictionary!("tests/data/words.txt", max_distance = 2, lowercase = true);
let top = sym.lookup("world", 2, Verbosity::Top);
assert_eq!(top.len(), 1);
assert_eq!(top[0].term, "world");
assert_eq!(top[0].distance, 0);
assert_eq!(top[0].frequency, 1);
let suggestions = sym.lookup("helo", 2, Verbosity::Closest);
assert!(suggestions.iter().any(|s| s.term == "hello"));
}
#[test]
fn test_include_macro_closest_multiple() {
let sym = include_dictionary!("tests/data/words.txt", max_distance = 2, lowercase = true);
let closest = sym.lookup("appl", 2, Verbosity::Closest);
let terms: Vec<&str> = closest.iter().map(|s| s.term.as_str()).collect();
assert!(terms.contains(&"apple"));
assert!(terms.contains(&"apply"));
}
#[test]
fn test_include_macro_all_and_ordering() {
let sym = include_dictionary!("tests/data/words.txt", max_distance = 2, lowercase = true);
let all = sym.lookup("teso", 2, Verbosity::All);
assert!(!all.is_empty());
let first = &all[0];
assert!(first.distance <= 2);
assert!(all.iter().any(|s| s.term == "test"));
}