Skip to content

Commit

Permalink
Add struct size/alignment tests to Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Sep 28, 2019
1 parent 13915dd commit 6865374
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bindings/rust/evmc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,19 @@ impl Default for evmc_bytes32 {
evmc_bytes32 { bytes: [0u8; 32] }
}
}

#[cfg(test)]
mod tests {
use std::mem::size_of;

use super::*;

#[test]
fn container_new() {
// TODO: add other checks from test/unittests/test_helpers.cpp
assert_eq!(size_of::<evmc_bytes32>(), 32);
assert_eq!(size_of::<evmc_address>(), 20);
assert!(size_of::<evmc_result>() <= 128);
assert!(size_of::<evmc_vm>() <= 64);
}
}

0 comments on commit 6865374

Please sign in to comment.