Skip to content

Commit f72bd77

Browse files
authored
Format (#255)
1 parent d2de0ab commit f72bd77

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

program/c/src/oracle/test_oracle.c

Lines changed: 0 additions & 21 deletions
This file was deleted.

program/rust/src/tests/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ mod test_del_publisher;
66
mod test_init_mapping;
77
mod test_init_price;
88
mod test_set_min_pub;
9+
mod test_sizes;
910
mod test_upd_aggregate;
1011
mod test_upd_price;
1112
mod test_upd_price_no_fail_on_error;

program/rust/src/tests/test_sizes.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use crate::c_oracle_header::{
2+
pc_map_table_t,
3+
pc_price_comp_t,
4+
pc_price_info_t,
5+
pc_price_t,
6+
pc_pub_key_t,
7+
PC_COMP_SIZE,
8+
PC_MAP_TABLE_SIZE,
9+
};
10+
use std::mem::size_of;
11+
12+
#[test]
13+
fn test_sizes() {
14+
assert_eq!(size_of::<pc_pub_key_t>(), 32);
15+
assert_eq!(
16+
size_of::<pc_map_table_t>(),
17+
24 + (PC_MAP_TABLE_SIZE as usize + 1) * size_of::<pc_pub_key_t>()
18+
);
19+
assert_eq!(size_of::<pc_price_info_t>(), 32);
20+
assert_eq!(
21+
size_of::<pc_price_comp_t>(),
22+
size_of::<pc_pub_key_t>() + 2 * size_of::<pc_price_info_t>()
23+
);
24+
assert_eq!(
25+
size_of::<pc_price_t>(),
26+
48 + 8 * size_of::<u64>()
27+
+ 3 * size_of::<pc_pub_key_t>()
28+
+ size_of::<pc_price_info_t>()
29+
+ (PC_COMP_SIZE as usize) * size_of::<pc_price_comp_t>()
30+
);
31+
}

0 commit comments

Comments
 (0)