1 #![allow(
2 dead_code,
3 non_snake_case,
4 non_camel_case_types,
5 non_upper_case_globals
6 )]
7
8 #[repr(C)]
9 #[derive(Debug, Default, Copy, Clone)]
10 pub struct Calc {
11 pub w: ::std::os::raw::c_int,
12 }
13 #[test]
bindgen_test_layout_Calcnull14 fn bindgen_test_layout_Calc() {
15 const UNINIT: ::std::mem::MaybeUninit<Calc> =
16 ::std::mem::MaybeUninit::uninit();
17 let ptr = UNINIT.as_ptr();
18 assert_eq!(
19 ::std::mem::size_of::<Calc>(),
20 4usize,
21 concat!("Size of: ", stringify!(Calc))
22 );
23 assert_eq!(
24 ::std::mem::align_of::<Calc>(),
25 4usize,
26 concat!("Alignment of ", stringify!(Calc))
27 );
28 assert_eq!(
29 unsafe { ::std::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
30 0usize,
31 concat!("Offset of field: ", stringify!(Calc), "::", stringify!(w))
32 );
33 }
34 #[repr(C)]
35 #[derive(Debug, Default, Copy, Clone)]
36 pub struct Test {
37 pub _address: u8,
38 }
39 #[repr(C)]
40 #[derive(Debug, Default, Copy, Clone)]
41 pub struct Test_Size {
42 pub mWidth: Test_Size_Dimension,
43 pub mHeight: Test_Size_Dimension,
44 }
45 #[repr(C)]
46 #[derive(Debug, Default, Copy, Clone)]
47 pub struct Test_Size_Dimension {
48 pub _base: Calc,
49 }
50 #[test]
bindgen_test_layout_Test_Size_Dimensionnull51 fn bindgen_test_layout_Test_Size_Dimension() {
52 assert_eq!(
53 ::std::mem::size_of::<Test_Size_Dimension>(),
54 4usize,
55 concat!("Size of: ", stringify!(Test_Size_Dimension))
56 );
57 assert_eq!(
58 ::std::mem::align_of::<Test_Size_Dimension>(),
59 4usize,
60 concat!("Alignment of ", stringify!(Test_Size_Dimension))
61 );
62 }
63 #[test]
bindgen_test_layout_Test_Sizenull64 fn bindgen_test_layout_Test_Size() {
65 const UNINIT: ::std::mem::MaybeUninit<Test_Size> =
66 ::std::mem::MaybeUninit::uninit();
67 let ptr = UNINIT.as_ptr();
68 assert_eq!(
69 ::std::mem::size_of::<Test_Size>(),
70 8usize,
71 concat!("Size of: ", stringify!(Test_Size))
72 );
73 assert_eq!(
74 ::std::mem::align_of::<Test_Size>(),
75 4usize,
76 concat!("Alignment of ", stringify!(Test_Size))
77 );
78 assert_eq!(
79 unsafe { ::std::ptr::addr_of!((*ptr).mWidth) as usize - ptr as usize },
80 0usize,
81 concat!(
82 "Offset of field: ",
83 stringify!(Test_Size),
84 "::",
85 stringify!(mWidth)
86 )
87 );
88 assert_eq!(
89 unsafe { ::std::ptr::addr_of!((*ptr).mHeight) as usize - ptr as usize },
90 4usize,
91 concat!(
92 "Offset of field: ",
93 stringify!(Test_Size),
94 "::",
95 stringify!(mHeight)
96 )
97 );
98 }
99 #[test]
bindgen_test_layout_Testnull100 fn bindgen_test_layout_Test() {
101 assert_eq!(
102 ::std::mem::size_of::<Test>(),
103 1usize,
104 concat!("Size of: ", stringify!(Test))
105 );
106 assert_eq!(
107 ::std::mem::align_of::<Test>(),
108 1usize,
109 concat!("Alignment of ", stringify!(Test))
110 );
111 }
112