forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_util.rs
61 lines (57 loc) · 1.65 KB
/
test_util.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use crate::{DataStore, DataStoreConfig};
// ---
#[doc(hidden)]
#[macro_export]
macro_rules! test_row {
($entity:ident @ $frames:tt => $n:expr; [$c0:expr $(,)*]) => {{
::re_log_types::DataRow::from_cells1_sized(
::re_log_types::RowId::random(),
$entity.clone(),
$frames,
$n,
$c0,
)
}};
($entity:ident @ $frames:tt => $n:expr; [$c0:expr, $c1:expr $(,)*]) => {{
::re_log_types::DataRow::from_cells2_sized(
::re_log_types::RowId::random(),
$entity.clone(),
$frames,
$n,
($c0, $c1),
)
}};
}
pub fn all_configs() -> impl Iterator<Item = DataStoreConfig> {
const INDEX_CONFIGS: &[DataStoreConfig] = &[
DataStoreConfig::DEFAULT,
DataStoreConfig {
indexed_bucket_num_rows: 0,
..DataStoreConfig::DEFAULT
},
DataStoreConfig {
indexed_bucket_num_rows: 1,
..DataStoreConfig::DEFAULT
},
DataStoreConfig {
indexed_bucket_num_rows: 2,
..DataStoreConfig::DEFAULT
},
DataStoreConfig {
indexed_bucket_num_rows: 3,
..DataStoreConfig::DEFAULT
},
];
INDEX_CONFIGS.iter().map(|idx| DataStoreConfig {
indexed_bucket_num_rows: idx.indexed_bucket_num_rows,
store_insert_ids: idx.store_insert_ids,
enable_typecheck: idx.enable_typecheck,
})
}
pub fn sanity_unwrap(store: &mut DataStore) {
if let err @ Err(_) = store.sanity_check() {
store.sort_indices_if_needed();
eprintln!("{store}");
err.unwrap();
}
}