diff --git a/program/c/src/oracle/test_oracle.c b/program/c/src/oracle/test_oracle.c deleted file mode 100644 index 10eae3e58..000000000 --- a/program/c/src/oracle/test_oracle.c +++ /dev/null @@ -1,21 +0,0 @@ -char heap_start[8192]; -#define PC_HEAP_START (heap_start) -#include "oracle.c" -#include - -uint64_t MAPPING_ACCOUNT_LAMPORTS = 143821440; -uint64_t PRODUCT_ACCOUNT_LAMPORTS = 4454400; -uint64_t PRICE_ACCOUNT_LAMPORTS = 23942400; - -Test(oracle, pc_size ) { - cr_assert( sizeof( pc_pub_key_t ) == 32 ); - cr_assert( sizeof( pc_map_table_t ) == - 24 + (PC_MAP_TABLE_SIZE+1)*sizeof( pc_pub_key_t) ); - cr_assert( sizeof( pc_price_info_t ) == 32 ); - cr_assert( sizeof( pc_price_comp_t ) == sizeof( pc_pub_key_t ) + - 2*sizeof( pc_price_info_t ) ); - cr_assert( sizeof( pc_price_t ) == 48 + - 8*sizeof(int64_t) + - 3*sizeof( pc_pub_key_t ) + sizeof( pc_price_info_t ) + - PC_COMP_SIZE * sizeof( pc_price_comp_t ) ); -} diff --git a/program/rust/src/tests/mod.rs b/program/rust/src/tests/mod.rs index 06009cd10..1274dfd1f 100644 --- a/program/rust/src/tests/mod.rs +++ b/program/rust/src/tests/mod.rs @@ -6,6 +6,7 @@ mod test_del_publisher; mod test_init_mapping; mod test_init_price; mod test_set_min_pub; +mod test_sizes; mod test_upd_aggregate; mod test_upd_price; mod test_upd_price_no_fail_on_error; diff --git a/program/rust/src/tests/test_sizes.rs b/program/rust/src/tests/test_sizes.rs new file mode 100644 index 000000000..507583961 --- /dev/null +++ b/program/rust/src/tests/test_sizes.rs @@ -0,0 +1,31 @@ +use crate::c_oracle_header::{ + pc_map_table_t, + pc_price_comp_t, + pc_price_info_t, + pc_price_t, + pc_pub_key_t, + PC_COMP_SIZE, + PC_MAP_TABLE_SIZE, +}; +use std::mem::size_of; + +#[test] +fn test_sizes() { + assert_eq!(size_of::(), 32); + assert_eq!( + size_of::(), + 24 + (PC_MAP_TABLE_SIZE as usize + 1) * size_of::() + ); + assert_eq!(size_of::(), 32); + assert_eq!( + size_of::(), + size_of::() + 2 * size_of::() + ); + assert_eq!( + size_of::(), + 48 + 8 * size_of::() + + 3 * size_of::() + + size_of::() + + (PC_COMP_SIZE as usize) * size_of::() + ); +}