diff options
author | Nikhil Shagrithaya <nikhilshagri@gmail.com> | 2017-01-26 18:30:31 +0530 |
---|---|---|
committer | Nikhil Shagrithaya <nikhilshagri@gmail.com> | 2017-01-26 18:35:00 +0530 |
commit | 78aaa32037880c28cce640aa8f989f738280f164 (patch) | |
tree | 6b52961f7c43790dbff4238e970a2bf57417ce63 | |
parent | 8eb9e3f406f83f297ccacf687791948cfd4ba872 (diff) |
Added test for forward declared complex types
-rw-r--r-- | tests/expectations/tests/forward_declared_complex_types.rs | 50 | ||||
-rw-r--r-- | tests/headers/forward_declared_complex_types.hpp | 16 |
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs new file mode 100644 index 00000000..77849a91 --- /dev/null +++ b/tests/expectations/tests/forward_declared_complex_types.rs @@ -0,0 +1,50 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Foo_empty { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_Foo_empty() { + assert_eq!(::std::mem::size_of::<Foo_empty>() , 1usize); + assert_eq!(::std::mem::align_of::<Foo_empty>() , 1usize); +} +impl Clone for Foo_empty { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +pub struct Foo([u8; 0]); +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Bar { + pub f: *mut Foo, +} +#[test] +fn bindgen_test_layout_Bar() { + assert_eq!(::std::mem::size_of::<Bar>() , 8usize); + assert_eq!(::std::mem::align_of::<Bar>() , 8usize); +} +impl Clone for Bar { + fn clone(&self) -> Self { *self } +} +extern "C" { + #[link_name = "_Z10baz_structP3Foo"] + pub fn baz_struct(f: *mut Foo); +} +#[repr(C)] +pub struct Union([u8; 0]); +extern "C" { + #[link_name = "_Z9baz_unionP5Union"] + pub fn baz_union(u: *mut Union); +} +#[repr(C)] +pub struct Quux([u8; 0]); +extern "C" { + #[link_name = "_Z9baz_classP4Quux"] + pub fn baz_class(q: *mut Quux); +} diff --git a/tests/headers/forward_declared_complex_types.hpp b/tests/headers/forward_declared_complex_types.hpp new file mode 100644 index 00000000..ffc779ad --- /dev/null +++ b/tests/headers/forward_declared_complex_types.hpp @@ -0,0 +1,16 @@ +struct Foo_empty {}; +struct Foo; + +struct Bar { + Foo *f; +}; + +void baz_struct(Foo* f); + +union Union; + +void baz_union(Union* u); + +class Quux; + +void baz_class(Quux* q); |