Skip to content

Commit 6865374

Browse files
committed
Add struct size/alignment tests to Rust
1 parent 13915dd commit 6865374

File tree

1 file changed

+16
-0
lines changed
  • bindings/rust/evmc-sys/src

1 file changed

+16
-0
lines changed

bindings/rust/evmc-sys/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,19 @@ impl Default for evmc_bytes32 {
3535
evmc_bytes32 { bytes: [0u8; 32] }
3636
}
3737
}
38+
39+
#[cfg(test)]
40+
mod tests {
41+
use std::mem::size_of;
42+
43+
use super::*;
44+
45+
#[test]
46+
fn container_new() {
47+
// TODO: add other checks from test/unittests/test_helpers.cpp
48+
assert_eq!(size_of::<evmc_bytes32>(), 32);
49+
assert_eq!(size_of::<evmc_address>(), 20);
50+
assert!(size_of::<evmc_result>() <= 128);
51+
assert!(size_of::<evmc_vm>() <= 64);
52+
}
53+
}

0 commit comments

Comments
 (0)