summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiting Zhu <zzhu@mozilla.com>2017-08-11 11:35:30 -0700
committerZhiting Zhu <zzhu@mozilla.com>2017-08-14 10:19:14 -0700
commit238499b52825e1397c8ab47cfe0dba39cf0745bd (patch)
treeda4a30aac3c9e9e0f44648e8c0614e9938b254a3
parent5b41c8ea0cc9f046ccafcd9dfdbd1faad579213d (diff)
Misc tests for derive PartialEq
-rw-r--r--tests/expectations/tests/16-byte-alignment.rs4
-rw-r--r--tests/expectations/tests/16-byte-alignment_1_0.rs15
-rw-r--r--tests/expectations/tests/char.rs2
-rw-r--r--tests/expectations/tests/issue-493.rs9
-rw-r--r--tests/expectations/tests/issue-493_1_0.rs13
-rw-r--r--tests/expectations/tests/typeref.rs6
-rw-r--r--tests/expectations/tests/typeref_1_0.rs15
-rw-r--r--tests/expectations/tests/use-core.rs2
-rw-r--r--tests/expectations/tests/use-core_1_0.rs7
-rw-r--r--tests/headers/16-byte-alignment.h2
-rw-r--r--tests/headers/16-byte-alignment_1_0.h2
-rw-r--r--tests/headers/char.h2
-rw-r--r--tests/headers/issue-493.hpp3
-rw-r--r--tests/headers/issue-493_1_0.hpp2
-rw-r--r--tests/headers/typeref.hpp3
-rw-r--r--tests/headers/typeref_1_0.hpp2
-rw-r--r--tests/headers/use-core.h2
-rw-r--r--tests/headers/use-core_1_0.h2
18 files changed, 53 insertions, 40 deletions
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs
index 72f2a8a9..45ec2ead 100644
--- a/tests/expectations/tests/16-byte-alignment.rs
+++ b/tests/expectations/tests/16-byte-alignment.rs
@@ -19,7 +19,7 @@ pub union rte_ipv4_tuple__bindgen_ty_1 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
@@ -112,7 +112,7 @@ pub union rte_ipv6_tuple__bindgen_ty_1 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs
index 1068f3f5..ee8a3261 100644
--- a/tests/expectations/tests/16-byte-alignment_1_0.rs
+++ b/tests/expectations/tests/16-byte-alignment_1_0.rs
@@ -31,22 +31,25 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
}
+impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
+ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv4_tuple {
pub src_addr: u32,
pub dst_addr: u32,
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv4_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>,
pub sctp_tag: __BindgenUnionField<u32>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
@@ -119,21 +122,21 @@ impl Clone for rte_ipv4_tuple {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv6_tuple {
pub src_addr: [u8; 16usize],
pub dst_addr: [u8; 16usize],
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv6_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>,
pub sctp_tag: __BindgenUnionField<u32>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs
index f34e075d..ac1700f5 100644
--- a/tests/expectations/tests/char.rs
+++ b/tests/expectations/tests/char.rs
@@ -8,7 +8,7 @@ pub type Char = ::std::os::raw::c_char;
pub type SChar = ::std::os::raw::c_schar;
pub type UChar = ::std::os::raw::c_uchar;
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Test {
pub ch: ::std::os::raw::c_char,
pub u: ::std::os::raw::c_uchar,
diff --git a/tests/expectations/tests/issue-493.rs b/tests/expectations/tests/issue-493.rs
index 21a08233..d5486ccc 100644
--- a/tests/expectations/tests/issue-493.rs
+++ b/tests/expectations/tests/issue-493.rs
@@ -31,8 +31,11 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
}
+impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
+ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct basic_string {
pub _address: u8,
}
@@ -40,7 +43,7 @@ pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
pub type basic_string_value_type = ::std::os::raw::c_char;
pub type basic_string_pointer = *mut basic_string_value_type;
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___long {
pub __cap_: basic_string_size_type,
pub __size_: basic_string_size_type,
@@ -86,7 +89,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum basic_string__bindgen_ty_2 { __n_words = 0, }
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___raw {
pub __words: *mut basic_string_size_type,
}
diff --git a/tests/expectations/tests/issue-493_1_0.rs b/tests/expectations/tests/issue-493_1_0.rs
index d25bb4a0..4ddc6188 100644
--- a/tests/expectations/tests/issue-493_1_0.rs
+++ b/tests/expectations/tests/issue-493_1_0.rs
@@ -31,8 +31,11 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
}
+impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
+ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct basic_string {
pub _address: u8,
}
@@ -40,7 +43,7 @@ pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
pub type basic_string_value_type = ::std::os::raw::c_char;
pub type basic_string_pointer = *mut basic_string_value_type;
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___long {
pub __cap_: basic_string_size_type,
pub __size_: basic_string_size_type,
@@ -55,13 +58,13 @@ pub const basic_string___min_cap: basic_string__bindgen_ty_1 =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum basic_string__bindgen_ty_1 { __min_cap = 0, }
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___short {
pub __bindgen_anon_1: basic_string___short__bindgen_ty_1,
pub __data_: *mut basic_string_value_type,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___short__bindgen_ty_1 {
pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>,
pub __lx: __BindgenUnionField<basic_string_value_type>,
@@ -86,7 +89,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum basic_string__bindgen_ty_2 { __n_words = 0, }
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___raw {
pub __words: *mut basic_string_size_type,
}
diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
index 044b8eaa..0a4edf4c 100644
--- a/tests/expectations/tests/typeref.rs
+++ b/tests/expectations/tests/typeref.rs
@@ -24,7 +24,7 @@ impl Default for nsFoo {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct mozilla_FragmentOrURL {
pub mIsLocalRef: bool,
}
@@ -46,7 +46,7 @@ impl Clone for mozilla_FragmentOrURL {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct mozilla_Position {
pub _address: u8,
}
@@ -77,7 +77,7 @@ impl Default for mozilla_StyleShapeSource {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct Bar {
pub mFoo: *mut nsFoo,
}
diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs
index 43427f08..d472f02b 100644
--- a/tests/expectations/tests/typeref_1_0.rs
+++ b/tests/expectations/tests/typeref_1_0.rs
@@ -31,8 +31,11 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
}
+impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
+ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct nsFoo {
pub mBar: mozilla_StyleShapeSource,
}
@@ -52,7 +55,7 @@ impl Clone for nsFoo {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct mozilla_FragmentOrURL {
pub mIsLocalRef: bool,
}
@@ -74,7 +77,7 @@ impl Clone for mozilla_FragmentOrURL {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct mozilla_Position {
pub _address: u8,
}
@@ -89,19 +92,19 @@ impl Clone for mozilla_Position {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct mozilla_StyleShapeSource {
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct mozilla_StyleShapeSource__bindgen_ty_1 {
pub mPosition: __BindgenUnionField<*mut mozilla_Position>,
pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>,
pub bindgen_union_field: u64,
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct Bar {
pub mFoo: *mut nsFoo,
}
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
index 09c6a86e..508e3b5d 100644
--- a/tests/expectations/tests/use-core.rs
+++ b/tests/expectations/tests/use-core.rs
@@ -6,7 +6,7 @@
extern crate core;
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct foo {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs
index fd89783f..b382454a 100644
--- a/tests/expectations/tests/use-core_1_0.rs
+++ b/tests/expectations/tests/use-core_1_0.rs
@@ -32,8 +32,11 @@ impl <T> ::core::fmt::Debug for __BindgenUnionField<T> {
impl <T> ::core::hash::Hash for __BindgenUnionField<T> {
fn hash<H: ::core::hash::Hasher>(&self, _state: &mut H) { }
}
+impl <T> ::core::cmp::PartialEq for __BindgenUnionField<T> {
+ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
+}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct foo {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
@@ -68,7 +71,7 @@ impl Default for foo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct _bindgen_ty_1 {
pub bar: __BindgenUnionField<::std::os::raw::c_int>,
pub baz: __BindgenUnionField<::std::os::raw::c_long>,
diff --git a/tests/headers/16-byte-alignment.h b/tests/headers/16-byte-alignment.h
index cca4d285..2fb3e2f3 100644
--- a/tests/headers/16-byte-alignment.h
+++ b/tests/headers/16-byte-alignment.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
diff --git a/tests/headers/16-byte-alignment_1_0.h b/tests/headers/16-byte-alignment_1_0.h
index f0ec0e64..89574e9f 100644
--- a/tests/headers/16-byte-alignment_1_0.h
+++ b/tests/headers/16-byte-alignment_1_0.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --rust-target 1.0 --with-derive-hash
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
diff --git a/tests/headers/char.h b/tests/headers/char.h
index 8db9ccf0..71bce553 100644
--- a/tests/headers/char.h
+++ b/tests/headers/char.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
typedef char Char;
typedef signed char SChar;
diff --git a/tests/headers/issue-493.hpp b/tests/headers/issue-493.hpp
index 40105e29..7c58a351 100644
--- a/tests/headers/issue-493.hpp
+++ b/tests/headers/issue-493.hpp
@@ -1,5 +1,4 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
template<class _CharT, class _Traits, class _Allocator>
class basic_string
{
diff --git a/tests/headers/issue-493_1_0.hpp b/tests/headers/issue-493_1_0.hpp
index ed8c7df8..2f43b16e 100644
--- a/tests/headers/issue-493_1_0.hpp
+++ b/tests/headers/issue-493_1_0.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --rust-target 1.0 --with-derive-hash
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
template<class _CharT, class _Traits, class _Allocator>
class basic_string
diff --git a/tests/headers/typeref.hpp b/tests/headers/typeref.hpp
index ff1d788e..d0710bfb 100644
--- a/tests/headers/typeref.hpp
+++ b/tests/headers/typeref.hpp
@@ -1,5 +1,4 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
struct nsFoo;
namespace mozilla {
diff --git a/tests/headers/typeref_1_0.hpp b/tests/headers/typeref_1_0.hpp
index 183cf7a1..0dad19b2 100644
--- a/tests/headers/typeref_1_0.hpp
+++ b/tests/headers/typeref_1_0.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --rust-target 1.0 --with-derive-hash
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
struct nsFoo;
diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h
index b34a71e7..b5fd0515 100644
--- a/tests/headers/use-core.h
+++ b/tests/headers/use-core.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash
+// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
struct foo {
int a, b;
diff --git a/tests/headers/use-core_1_0.h b/tests/headers/use-core_1_0.h
index fa3a9648..f525bccf 100644
--- a/tests/headers/use-core_1_0.h
+++ b/tests/headers/use-core_1_0.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash
+// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
struct foo {
int a, b;