1#![allow(clippy::let_underscore_untyped, clippy::unreadable_literal)]
2
3use std::mem::size_of_val;
4
5#[test]
6fn test_size() {
7 #[allow(dead_code)]
8 #[path = "../src/tables.rs"]
9 mod tables;
10
11 let size = size_of_val(&tables::ASCII_START)
12 + size_of_val(&tables::ASCII_CONTINUE)
13 + size_of_val(&tables::TRIE_START)
14 + size_of_val(&tables::TRIE_CONTINUE)
15 + size_of_val(&tables::LEAF);
16 assert_eq!(10080, size);
17}
18
19#[test]
20fn test_xid_size() {
21 #[deny(dead_code)]
22 #[path = "tables/mod.rs"]
23 mod tables;
24
25 let size = size_of_val(tables::XID_START) + size_of_val(tables::XID_CONTINUE);
26 assert_eq!(11544, size);
27
28 let _ = tables::BY_NAME;
29}
30
31#[cfg(target_pointer_width = "64")]
32#[test]
33fn test_trieset_size() {
34 #[deny(dead_code)]
35 #[allow(clippy::redundant_static_lifetimes)]
36 #[path = "trie/trie.rs"]
37 mod trie;
38
39 let ucd_trie::TrieSet {
40 tree1_level1,
41 tree2_level1,
42 tree2_level2,
43 tree3_level1,
44 tree3_level2,
45 tree3_level3,
46 } = *trie::XID_START;
47
48 let start_size = size_of_val(trie::XID_START)
49 + size_of_val(tree1_level1)
50 + size_of_val(tree2_level1)
51 + size_of_val(tree2_level2)
52 + size_of_val(tree3_level1)
53 + size_of_val(tree3_level2)
54 + size_of_val(tree3_level3);
55
56 let ucd_trie::TrieSet {
57 tree1_level1,
58 tree2_level1,
59 tree2_level2,
60 tree3_level1,
61 tree3_level2,
62 tree3_level3,
63 } = *trie::XID_CONTINUE;
64
65 let continue_size = size_of_val(trie::XID_CONTINUE)
66 + size_of_val(tree1_level1)
67 + size_of_val(tree2_level1)
68 + size_of_val(tree2_level2)
69 + size_of_val(tree3_level1)
70 + size_of_val(tree3_level2)
71 + size_of_val(tree3_level3);
72
73 assert_eq!(10200, start_size + continue_size);
74
75 let _ = trie::BY_NAME;
76}
77
78#[test]
79fn test_fst_size() {
80 let xid_start_fst = include_bytes!("fst/xid_start.fst");
81 let xid_continue_fst = include_bytes!("fst/xid_continue.fst");
82 let size = xid_start_fst.len() + xid_continue_fst.len();
83 assert_eq!(138736, size);
84}
85
86#[test]
87fn test_roaring_size() {
88 #[path = "roaring/mod.rs"]
89 mod roaring;
90
91 let xid_start_bitmap = roaring::xid_start_bitmap();
92 let xid_continue_bitmap = roaring::xid_continue_bitmap();
93 let size = xid_start_bitmap.serialized_size() + xid_continue_bitmap.serialized_size();
94 assert_eq!(66104, size);
95}
96