diff options
-rw-r--r-- | tests/expectations/tests/convert-cpp-comment-to-rust.rs | 49 | ||||
-rw-r--r-- | tests/expectations/tests/derive-custom.rs | 69 | ||||
-rw-r--r-- | tests/headers/convert-cpp-comment-to-rust.hpp | 2 | ||||
-rw-r--r-- | tests/headers/derive-custom.h | 2 |
4 files changed, 2 insertions, 120 deletions
diff --git a/tests/expectations/tests/convert-cpp-comment-to-rust.rs b/tests/expectations/tests/convert-cpp-comment-to-rust.rs index 86279caf..09a22c4f 100644 --- a/tests/expectations/tests/convert-cpp-comment-to-rust.rs +++ b/tests/expectations/tests/convert-cpp-comment-to-rust.rs @@ -17,55 +17,6 @@ pub struct mbedtls_mpi { ///< pointer to limbs pub p: *mut mbedtls_mpi_uint, } -#[test] -fn bindgen_test_layout_mbedtls_mpi() { - assert_eq!( - ::std::mem::size_of::<mbedtls_mpi>(), - 24usize, - concat!("Size of: ", stringify!(mbedtls_mpi)) - ); - assert_eq!( - ::std::mem::align_of::<mbedtls_mpi>(), - 8usize, - concat!("Alignment of ", stringify!(mbedtls_mpi)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<mbedtls_mpi>())).s as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(mbedtls_mpi), - "::", - stringify!(s) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<mbedtls_mpi>())).n as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(mbedtls_mpi), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<mbedtls_mpi>())).p as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(mbedtls_mpi), - "::", - stringify!(p) - ) - ); -} impl Default for mbedtls_mpi { fn default() -> Self { let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); diff --git a/tests/expectations/tests/derive-custom.rs b/tests/expectations/tests/derive-custom.rs index 1cae9af0..542b6bb2 100644 --- a/tests/expectations/tests/derive-custom.rs +++ b/tests/expectations/tests/derive-custom.rs @@ -11,29 +11,6 @@ pub struct my_type { pub a: ::std::os::raw::c_int, } -#[test] -fn bindgen_test_layout_my_type() { - assert_eq!( - ::std::mem::size_of::<my_type>(), - 4usize, - concat!("Size of: ", stringify!(my_type)) - ); - assert_eq!( - ::std::mem::align_of::<my_type>(), - 4usize, - concat!("Alignment of ", stringify!(my_type)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<my_type>())).a as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(my_type), - "::", - stringify!(a) - ) - ); -} /// <div rustbindgen derive="Debug"></div> /// <div rustbindgen derive="Clone"></div> #[repr(C)] @@ -41,55 +18,9 @@ fn bindgen_test_layout_my_type() { pub struct my_type2 { pub a: ::std::os::raw::c_uint, } -#[test] -fn bindgen_test_layout_my_type2() { - assert_eq!( - ::std::mem::size_of::<my_type2>(), - 4usize, - concat!("Size of: ", stringify!(my_type2)) - ); - assert_eq!( - ::std::mem::align_of::<my_type2>(), - 4usize, - concat!("Alignment of ", stringify!(my_type2)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<my_type2>())).a as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(my_type2), - "::", - stringify!(a) - ) - ); -} /// <div rustbindgen derive="Debug" derive="Clone"></div> #[repr(C)] #[derive(Default, Debug, Clone)] pub struct my_type3 { pub a: ::std::os::raw::c_ulong, } -#[test] -fn bindgen_test_layout_my_type3() { - assert_eq!( - ::std::mem::size_of::<my_type3>(), - 8usize, - concat!("Size of: ", stringify!(my_type3)) - ); - assert_eq!( - ::std::mem::align_of::<my_type3>(), - 8usize, - concat!("Alignment of ", stringify!(my_type3)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<my_type3>())).a as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(my_type3), - "::", - stringify!(a) - ) - ); -} diff --git a/tests/headers/convert-cpp-comment-to-rust.hpp b/tests/headers/convert-cpp-comment-to-rust.hpp index 649c2365..f5bbbf58 100644 --- a/tests/headers/convert-cpp-comment-to-rust.hpp +++ b/tests/headers/convert-cpp-comment-to-rust.hpp @@ -1,4 +1,4 @@ - +// bindgen-flags: --no-layout-tests typedef unsigned mbedtls_mpi_uint; /** diff --git a/tests/headers/derive-custom.h b/tests/headers/derive-custom.h index 83f2ce08..8c57278c 100644 --- a/tests/headers/derive-custom.h +++ b/tests/headers/derive-custom.h @@ -1,4 +1,4 @@ -// bindgen-flags: --no-derive-debug --no-derive-copy --default-enum-style rust +// bindgen-flags: --no-derive-debug --no-derive-copy --default-enum-style rust --no-layout-tests /** <div rustbindgen derive="Debug"></div> */ struct my_type; |