5 let nfc = "V\197\169 Ng\225\187\141c Phan"
6 and nfd
= "Vu\204\131 Ngo\204\163c Phan" in
7 Assrt.equals_string __LOC__
"Vũ Ngọc Phan" nfc;
8 Assrt.equals_string __LOC__
"Vũ Ngọc Phan" nfd
;
9 Assrt.equals_string __LOC__
"Vu Ngoc Phan" (Ubase.from_utf8
nfc);
10 Assrt.equals_string __LOC__
"Vu Ngoc Phan" (Ubase.from_utf8 nfd
)
13 let t0 = Str.regexp_case_fold
".*yst.*" in
14 assert (Str.string_match
t0 "haystack" 0);
15 let t2 = Str.regexp_string_case_fold
"ySt" in
16 assert (2 = Str.search_forward
t2 "haystack" 0);
17 assert (2 = try Str.search_forward
t2 "haystack" 0 with Not_found
-> -1);
18 assert (-1 = try Str.search_forward
t2 "hay_stack" 0 with Not_found
-> -1);
19 assert (0 <= try Str.search_forward
t2 "haystack" 0 with Not_found
-> -1)
22 Assrt.equals_int __LOC__ 5 (List.length c0.url_cleaner);
23 Assrt.equals_int __LOC__ 2 (List.length c0.posse)
27 let t = Str.regexp_case_fold
".*yst.*" in
28 Assrt.equals_int __LOC__
1 (Search.string_rank
t "haystack")
31 let tp = [ "föo"; "bär"; "báz" ] |> Search.needles_prepare
in
32 ("my fÓo", "", "") |> Search.entry_rank
tp |> Assrt.equals_int __LOC__
2
35 "my 😷 ö" |> Ubase.from_utf8
|> Assrt.equals_string __LOC__
"my 😷 o"
38 Unix.chdir
"../../../test/";