summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZhiting Zhu <zhitingz@cs.utexas.edu>2017-08-16 19:43:17 -0500
committerZhiting Zhu <zhitingz@cs.utexas.edu>2017-08-21 16:14:41 -0500
commit1990e9109e526d08a30f67f7a7528b8f73814c25 (patch)
treeeafaebab4ca07a424ff539eb69c8c15fcb789a83 /tests
parent393ac53cdc591e8bfd68e373b6df06c11fc35443 (diff)
Class related tests for can derive Eq
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/tests/class.rs4
-rw-r--r--tests/expectations/tests/class_1_0.rs5
-rw-r--r--tests/expectations/tests/class_nested.rs14
-rw-r--r--tests/expectations/tests/class_no_members.rs6
-rw-r--r--tests/expectations/tests/class_static.rs2
-rw-r--r--tests/expectations/tests/class_static_const.rs2
-rw-r--r--tests/expectations/tests/class_use_as.rs4
-rw-r--r--tests/expectations/tests/class_with_dtor.rs4
-rw-r--r--tests/expectations/tests/class_with_inner_struct.rs10
-rw-r--r--tests/expectations/tests/class_with_inner_struct_1_0.rs17
-rw-r--r--tests/expectations/tests/class_with_typedef.rs4
-rw-r--r--tests/headers/class.hpp2
-rw-r--r--tests/headers/class_1_0.hpp2
-rw-r--r--tests/headers/class_nested.hpp2
-rw-r--r--tests/headers/class_no_members.hpp2
-rw-r--r--tests/headers/class_static.hpp2
-rw-r--r--tests/headers/class_static_const.hpp2
-rw-r--r--tests/headers/class_use_as.hpp2
-rw-r--r--tests/headers/class_with_dtor.hpp2
-rw-r--r--tests/headers/class_with_inner_struct.hpp2
-rw-r--r--tests/headers/class_with_inner_struct_1_0.hpp2
-rw-r--r--tests/headers/class_with_typedef.hpp2
22 files changed, 48 insertions, 46 deletions
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs
index 0332c50e..d1216655 100644
--- a/tests/expectations/tests/class.rs
+++ b/tests/expectations/tests/class.rs
@@ -141,7 +141,7 @@ impl Default for C_with_zero_length_array_and_incomplete_array {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Hash, PartialEq)]
+#[derive(Debug, Default, Hash, PartialEq, Eq)]
pub struct WithDtor {
pub b: ::std::os::raw::c_int,
}
@@ -229,7 +229,7 @@ impl Default for WithUnion {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct RealAbstractionWithTonsOfMethods {
pub _address: u8,
}
diff --git a/tests/expectations/tests/class_1_0.rs b/tests/expectations/tests/class_1_0.rs
index 21399a49..8ccf4e01 100644
--- a/tests/expectations/tests/class_1_0.rs
+++ b/tests/expectations/tests/class_1_0.rs
@@ -67,6 +67,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
}
+impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { }
#[repr(C)]
#[derive(Copy)]
pub struct C {
@@ -171,7 +172,7 @@ impl Default for C_with_zero_length_array_and_incomplete_array {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Hash, PartialEq)]
+#[derive(Debug, Default, Hash, PartialEq, Eq)]
pub struct WithDtor {
pub b: ::std::os::raw::c_int,
}
@@ -253,7 +254,7 @@ impl Clone for WithUnion {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct RealAbstractionWithTonsOfMethods {
pub _address: u8,
}
diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs
index dc40fd06..76658b2e 100644
--- a/tests/expectations/tests/class_nested.rs
+++ b/tests/expectations/tests/class_nested.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A {
pub member_a: ::std::os::raw::c_int,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A_B {
pub member_b: ::std::os::raw::c_int,
}
@@ -30,7 +30,7 @@ impl Clone for A_B {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A_C {
pub baz: ::std::os::raw::c_int,
}
@@ -50,7 +50,7 @@ impl Clone for A_C {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash, PartialEq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A_D<T> {
pub foo: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -93,7 +93,7 @@ extern "C" {
pub static mut baz: A_D<::std::os::raw::c_int>;
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct D {
pub member: A_B,
}
@@ -113,13 +113,13 @@ impl Clone for D {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash, PartialEq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Templated<T> {
pub member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash, PartialEq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Templated_Templated_inner<T> {
pub member_ptr: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs
index 4eb883d9..7fc05c5f 100644
--- a/tests/expectations/tests/class_no_members.rs
+++ b/tests/expectations/tests/class_no_members.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct whatever {
pub _address: u8,
}
@@ -20,7 +20,7 @@ impl Clone for whatever {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct whatever_child {
pub _address: u8,
}
@@ -35,7 +35,7 @@ impl Clone for whatever_child {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct whatever_child_with_member {
pub m_member: ::std::os::raw::c_int,
}
diff --git a/tests/expectations/tests/class_static.rs b/tests/expectations/tests/class_static.rs
index 703fa072..84f129df 100644
--- a/tests/expectations/tests/class_static.rs
+++ b/tests/expectations/tests/class_static.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct MyClass {
pub _address: u8,
}
diff --git a/tests/expectations/tests/class_static_const.rs b/tests/expectations/tests/class_static_const.rs
index 27e5b645..9a4b5425 100644
--- a/tests/expectations/tests/class_static_const.rs
+++ b/tests/expectations/tests/class_static_const.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A {
pub _address: u8,
}
diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs
index c721f1ae..4d2ae275 100644
--- a/tests/expectations/tests/class_use_as.rs
+++ b/tests/expectations/tests/class_use_as.rs
@@ -6,7 +6,7 @@
/// <div rustbindgen="true" replaces="whatever"></div>
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct whatever {
pub replacement: ::std::os::raw::c_int,
}
@@ -26,7 +26,7 @@ impl Clone for whatever {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct container {
pub c: whatever,
}
diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs
index 0ef190a9..8171288a 100644
--- a/tests/expectations/tests/class_with_dtor.rs
+++ b/tests/expectations/tests/class_with_dtor.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Hash, PartialEq)]
+#[derive(Debug, Hash, PartialEq, Eq)]
pub struct HandleWithDtor<T> {
pub ptr: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -15,7 +15,7 @@ impl <T> Default for HandleWithDtor<T> {
}
pub type HandleValue = HandleWithDtor<::std::os::raw::c_int>;
#[repr(C)]
-#[derive(Debug, Hash, PartialEq)]
+#[derive(Debug, Hash, PartialEq, Eq)]
pub struct WithoutDtor {
pub shouldBeWithDtor: HandleValue,
}
diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs
index 7cc0024f..03df6008 100644
--- a/tests/expectations/tests/class_with_inner_struct.rs
+++ b/tests/expectations/tests/class_with_inner_struct.rs
@@ -12,7 +12,7 @@ pub struct A {
pub __bindgen_anon_1: A__bindgen_ty_2,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
@@ -108,12 +108,12 @@ impl Default for A {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct B {
pub d: ::std::os::raw::c_uint,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct B_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
@@ -219,7 +219,7 @@ impl Clone for C__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct C__bindgen_ty_1__bindgen_ty_2 {
pub mStepSyntax: StepSyntax,
pub mSteps: ::std::os::raw::c_uint,
@@ -271,7 +271,7 @@ impl Default for C__bindgen_ty_1 {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct C_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs
index aa4bc2f0..42376dee 100644
--- a/tests/expectations/tests/class_with_inner_struct_1_0.rs
+++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs
@@ -34,15 +34,16 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
}
+impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { }
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A {
pub c: ::std::os::raw::c_uint,
pub named_union: A__bindgen_ty_1,
pub __bindgen_anon_1: A__bindgen_ty_2,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
@@ -68,7 +69,7 @@ impl Clone for A_Segment {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A__bindgen_ty_1 {
pub f: __BindgenUnionField<::std::os::raw::c_int>,
pub bindgen_union_field: u32,
@@ -89,7 +90,7 @@ impl Clone for A__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct A__bindgen_ty_2 {
pub d: __BindgenUnionField<::std::os::raw::c_int>,
pub bindgen_union_field: u32,
@@ -129,12 +130,12 @@ impl Clone for A {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct B {
pub d: ::std::os::raw::c_uint,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct B_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
@@ -240,7 +241,7 @@ impl Clone for C__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct C__bindgen_ty_1__bindgen_ty_2 {
pub mStepSyntax: StepSyntax,
pub mSteps: ::std::os::raw::c_uint,
@@ -289,7 +290,7 @@ impl Clone for C__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct C_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs
index 053bc06b..159f2735 100644
--- a/tests/expectations/tests/class_with_typedef.rs
+++ b/tests/expectations/tests/class_with_typedef.rs
@@ -6,7 +6,7 @@
pub type AnotherInt = ::std::os::raw::c_int;
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct C {
pub c: C_MyInt,
pub ptr: *mut C_MyInt,
@@ -85,7 +85,7 @@ impl C {
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct D {
pub _base: C,
pub ptr: *mut C_MyInt,
diff --git a/tests/headers/class.hpp b/tests/headers/class.hpp
index c8c041dc..ac2da1a4 100644
--- a/tests/headers/class.hpp
+++ b/tests/headers/class.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
//
class C {
int a;
diff --git a/tests/headers/class_1_0.hpp b/tests/headers/class_1_0.hpp
index 7400a2a5..ee00c2b7 100644
--- a/tests/headers/class_1_0.hpp
+++ b/tests/headers/class_1_0.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq
class C {
int a;
diff --git a/tests/headers/class_nested.hpp b/tests/headers/class_nested.hpp
index 09213576..d6ca02c2 100644
--- a/tests/headers/class_nested.hpp
+++ b/tests/headers/class_nested.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
class A {
public:
int member_a;
diff --git a/tests/headers/class_no_members.hpp b/tests/headers/class_no_members.hpp
index 4c80f7f8..6963e372 100644
--- a/tests/headers/class_no_members.hpp
+++ b/tests/headers/class_no_members.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
// bindgen-flags: -- -std=c++11
class whatever {
diff --git a/tests/headers/class_static.hpp b/tests/headers/class_static.hpp
index 18660132..d8f9be6d 100644
--- a/tests/headers/class_static.hpp
+++ b/tests/headers/class_static.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
class MyClass {
public:
static const int* example;
diff --git a/tests/headers/class_static_const.hpp b/tests/headers/class_static_const.hpp
index 7742c782..3e320edc 100644
--- a/tests/headers/class_static_const.hpp
+++ b/tests/headers/class_static_const.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
using int32_t = int;
typedef unsigned int uint32_t;
diff --git a/tests/headers/class_use_as.hpp b/tests/headers/class_use_as.hpp
index 267185c7..b7eaf29b 100644
--- a/tests/headers/class_use_as.hpp
+++ b/tests/headers/class_use_as.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
/**
* <div rustbindgen="true" replaces="whatever"></div>
diff --git a/tests/headers/class_with_dtor.hpp b/tests/headers/class_with_dtor.hpp
index 42374c47..f52858a7 100644
--- a/tests/headers/class_with_dtor.hpp
+++ b/tests/headers/class_with_dtor.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
template <typename T>
diff --git a/tests/headers/class_with_inner_struct.hpp b/tests/headers/class_with_inner_struct.hpp
index c50cfa2b..3cb6cfed 100644
--- a/tests/headers/class_with_inner_struct.hpp
+++ b/tests/headers/class_with_inner_struct.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
// bindgen-flags: -- -std=c++11
class A {
diff --git a/tests/headers/class_with_inner_struct_1_0.hpp b/tests/headers/class_with_inner_struct_1_0.hpp
index 86338b06..0bb8a57f 100644
--- a/tests/headers/class_with_inner_struct_1_0.hpp
+++ b/tests/headers/class_with_inner_struct_1_0.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq
// bindgen-flags: -- -std=c++11
class A {
diff --git a/tests/headers/class_with_typedef.hpp b/tests/headers/class_with_typedef.hpp
index df2afb98..7c3d3c97 100644
--- a/tests/headers/class_with_typedef.hpp
+++ b/tests/headers/class_with_typedef.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
typedef int AnotherInt;
class C {