1mod fst;
2mod roaring;
3mod trie;
4
5#[test]
6fn compare_all_implementations() {
7 let xid_start_fst = fst::xid_start_fst();
8 let xid_continue_fst = fst::xid_continue_fst();
9 let xid_start_roaring = roaring::xid_start_bitmap();
10 let xid_continue_roaring = roaring::xid_continue_bitmap();
11
12 for ch in '\0'..=char::MAX {
13 let thought_to_be_start = unicode_ident::is_xid_start(ch);
14 let thought_to_be_continue = unicode_ident::is_xid_continue(ch);
15
16 // unicode-xid
17 // FIXME: unicode-xid does not support Unicode 15.1.0 yet.
18 /*
19 assert_eq!(
20 thought_to_be_start,
21 unicode_xid::UnicodeXID::is_xid_start(ch),
22 "{ch:?}",
23 );
24 assert_eq!(
25 thought_to_be_continue,
26 unicode_xid::UnicodeXID::is_xid_continue(ch),
27 "{ch:?}",
28 );
29 */
30
31 // ucd-trie
32 assert_eq!(
33 thought_to_be_start,
34 trie::XID_START.contains_char(ch),
35 "{ch:?}",
36 );
37 assert_eq!(
38 thought_to_be_continue,
39 trie::XID_CONTINUE.contains_char(ch),
40 "{ch:?}",
41 );
42
43 // fst
44 assert_eq!(
45 thought_to_be_start,
46 xid_start_fst.contains((ch as u32).to_be_bytes()),
47 "{ch:?}",
48 );
49 assert_eq!(
50 thought_to_be_continue,
51 xid_continue_fst.contains((ch as u32).to_be_bytes()),
52 "{ch:?}",
53 );
54
55 // roaring
56 assert_eq!(
57 thought_to_be_start,
58 xid_start_roaring.contains(ch as u32),
59 "{ch:?}",
60 );
61 assert_eq!(
62 thought_to_be_continue,
63 xid_continue_roaring.contains(ch as u32),
64 "{ch:?}",
65 );
66 }
67}
68