blob: fe18fb1a0abb5e53432b7510fa8a2b498fbd0614 [file] [log] [blame]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct bar {
pub u: foo,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct foo {
pub foo: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
::std::mem::size_of::<foo>(),
4usize,
concat!("Size of: ", stringify!(foo))
);
assert_eq!(
::std::mem::align_of::<foo>(),
4usize,
concat!("Alignment of ", stringify!(foo))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<foo>())).foo as *const _ as usize },
0usize,
concat!("Offset of field: ", stringify!(foo), "::", stringify!(foo))
);
}
#[test]
fn bindgen_test_layout_bar() {
assert_eq!(
::std::mem::size_of::<bar>(),
4usize,
concat!("Size of: ", stringify!(bar))
);
assert_eq!(
::std::mem::align_of::<bar>(),
4usize,
concat!("Alignment of ", stringify!(bar))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<bar>())).u as *const _ as usize },
0usize,
concat!("Offset of field: ", stringify!(bar), "::", stringify!(u))
);
}
pub type bar_t = bar;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct baz {
pub f: foo,
}
#[test]
fn bindgen_test_layout_baz() {
assert_eq!(
::std::mem::size_of::<baz>(),
4usize,
concat!("Size of: ", stringify!(baz))
);
assert_eq!(
::std::mem::align_of::<baz>(),
4usize,
concat!("Alignment of ", stringify!(baz))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<baz>())).f as *const _ as usize },
0usize,
concat!("Offset of field: ", stringify!(baz), "::", stringify!(f))
);
}