Add expectancy test

This commit is contained in:
ManyTheFish 2023-02-01 18:39:54 +01:00
parent 064158e4e2
commit 643d99e0f9

View File

@ -446,6 +446,27 @@ mod test {
use super::*; use super::*;
use crate::index::tests::TempIndex; use crate::index::tests::TempIndex;
#[test]
fn test_kanji_language_detection() {
let index = TempIndex::new();
index
.add_documents(documents!([
{ "id": 0, "title": "The quick (\"brown\") fox can't jump 32.3 feet, right? Brr, it's 29.3°F!" },
{ "id": 1, "title": "東京のお寿司。" },
{ "id": 2, "title": "הַשּׁוּעָל הַמָּהִיר (״הַחוּם״) לֹא יָכוֹל לִקְפֹּץ 9.94 מֶטְרִים, נָכוֹן? ברר, 1.5°C- בַּחוּץ!" }
]))
.unwrap();
let txn = index.write_txn().unwrap();
let mut search = Search::new(&txn, &index);
search.query("東京");
let SearchResult { documents_ids, .. } = search.execute().unwrap();
assert_eq!(documents_ids, vec![1]);
}
#[test] #[test]
fn test_is_authorized_typos() { fn test_is_authorized_typos() {
let index = TempIndex::new(); let index = TempIndex::new();