Add struct size/alignment tests to Rust

This commit is contained in:
Alex Beregszaszi 2019-09-28 11:42:44 +01:00
parent 8eac50424e
commit f721642851
1 changed files with 16 additions and 0 deletions

View File

@ -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>() <= 64);
assert!(size_of::<evmc_vm>() <= 64);
}
}