Skip to content

Commit 238499b

Browse files
author
Zhiting Zhu
committed
Misc tests for derive PartialEq
1 parent 5b41c8e commit 238499b

18 files changed

+53
-40
lines changed

tests/expectations/tests/16-byte-alignment.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub union rte_ipv4_tuple__bindgen_ty_1 {
1919
_bindgen_union_align: u32,
2020
}
2121
#[repr(C)]
22-
#[derive(Debug, Default, Copy, Hash)]
22+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
2323
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
2424
pub dport: u16,
2525
pub sport: u16,
@@ -112,7 +112,7 @@ pub union rte_ipv6_tuple__bindgen_ty_1 {
112112
_bindgen_union_align: u32,
113113
}
114114
#[repr(C)]
115-
#[derive(Debug, Default, Copy, Hash)]
115+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
116116
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
117117
pub dport: u16,
118118
pub sport: u16,

tests/expectations/tests/16-byte-alignment_1_0.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,25 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
3131
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3232
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
3333
}
34+
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
35+
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
36+
}
3437
#[repr(C)]
35-
#[derive(Debug, Default, Copy, Hash)]
38+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
3639
pub struct rte_ipv4_tuple {
3740
pub src_addr: u32,
3841
pub dst_addr: u32,
3942
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
4043
}
4144
#[repr(C)]
42-
#[derive(Debug, Default, Copy, Hash)]
45+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
4346
pub struct rte_ipv4_tuple__bindgen_ty_1 {
4447
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>,
4548
pub sctp_tag: __BindgenUnionField<u32>,
4649
pub bindgen_union_field: u32,
4750
}
4851
#[repr(C)]
49-
#[derive(Debug, Default, Copy, Hash)]
52+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
5053
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
5154
pub dport: u16,
5255
pub sport: u16,
@@ -119,21 +122,21 @@ impl Clone for rte_ipv4_tuple {
119122
fn clone(&self) -> Self { *self }
120123
}
121124
#[repr(C)]
122-
#[derive(Debug, Default, Copy, Hash)]
125+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
123126
pub struct rte_ipv6_tuple {
124127
pub src_addr: [u8; 16usize],
125128
pub dst_addr: [u8; 16usize],
126129
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
127130
}
128131
#[repr(C)]
129-
#[derive(Debug, Default, Copy, Hash)]
132+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
130133
pub struct rte_ipv6_tuple__bindgen_ty_1 {
131134
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>,
132135
pub sctp_tag: __BindgenUnionField<u32>,
133136
pub bindgen_union_field: u32,
134137
}
135138
#[repr(C)]
136-
#[derive(Debug, Default, Copy, Hash)]
139+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
137140
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
138141
pub dport: u16,
139142
pub sport: u16,

tests/expectations/tests/char.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub type Char = ::std::os::raw::c_char;
88
pub type SChar = ::std::os::raw::c_schar;
99
pub type UChar = ::std::os::raw::c_uchar;
1010
#[repr(C)]
11-
#[derive(Debug, Default, Copy, Hash)]
11+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
1212
pub struct Test {
1313
pub ch: ::std::os::raw::c_char,
1414
pub u: ::std::os::raw::c_uchar,

tests/expectations/tests/issue-493.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
3131
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3232
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
3333
}
34+
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
35+
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
36+
}
3437
#[repr(C)]
35-
#[derive(Debug, Default, Copy, Clone, Hash)]
38+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
3639
pub struct basic_string {
3740
pub _address: u8,
3841
}
3942
pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
4043
pub type basic_string_value_type = ::std::os::raw::c_char;
4144
pub type basic_string_pointer = *mut basic_string_value_type;
4245
#[repr(C)]
43-
#[derive(Debug, Copy, Clone, Hash)]
46+
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
4447
pub struct basic_string___long {
4548
pub __cap_: basic_string_size_type,
4649
pub __size_: basic_string_size_type,
@@ -86,7 +89,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 =
8689
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
8790
pub enum basic_string__bindgen_ty_2 { __n_words = 0, }
8891
#[repr(C)]
89-
#[derive(Debug, Copy, Clone, Hash)]
92+
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
9093
pub struct basic_string___raw {
9194
pub __words: *mut basic_string_size_type,
9295
}

tests/expectations/tests/issue-493_1_0.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
3131
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3232
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
3333
}
34+
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
35+
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
36+
}
3437
#[repr(C)]
35-
#[derive(Debug, Default, Copy, Clone, Hash)]
38+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
3639
pub struct basic_string {
3740
pub _address: u8,
3841
}
3942
pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
4043
pub type basic_string_value_type = ::std::os::raw::c_char;
4144
pub type basic_string_pointer = *mut basic_string_value_type;
4245
#[repr(C)]
43-
#[derive(Debug, Copy, Clone, Hash)]
46+
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
4447
pub struct basic_string___long {
4548
pub __cap_: basic_string_size_type,
4649
pub __size_: basic_string_size_type,
@@ -55,13 +58,13 @@ pub const basic_string___min_cap: basic_string__bindgen_ty_1 =
5558
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
5659
pub enum basic_string__bindgen_ty_1 { __min_cap = 0, }
5760
#[repr(C)]
58-
#[derive(Debug, Copy, Clone, Hash)]
61+
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
5962
pub struct basic_string___short {
6063
pub __bindgen_anon_1: basic_string___short__bindgen_ty_1,
6164
pub __data_: *mut basic_string_value_type,
6265
}
6366
#[repr(C)]
64-
#[derive(Debug, Default, Copy, Clone, Hash)]
67+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
6568
pub struct basic_string___short__bindgen_ty_1 {
6669
pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>,
6770
pub __lx: __BindgenUnionField<basic_string_value_type>,
@@ -86,7 +89,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 =
8689
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
8790
pub enum basic_string__bindgen_ty_2 { __n_words = 0, }
8891
#[repr(C)]
89-
#[derive(Debug, Copy, Clone, Hash)]
92+
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
9093
pub struct basic_string___raw {
9194
pub __words: *mut basic_string_size_type,
9295
}

tests/expectations/tests/typeref.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl Default for nsFoo {
2424
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
2525
}
2626
#[repr(C)]
27-
#[derive(Debug, Default, Copy, Hash)]
27+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
2828
pub struct mozilla_FragmentOrURL {
2929
pub mIsLocalRef: bool,
3030
}
@@ -46,7 +46,7 @@ impl Clone for mozilla_FragmentOrURL {
4646
fn clone(&self) -> Self { *self }
4747
}
4848
#[repr(C)]
49-
#[derive(Debug, Default, Copy, Hash)]
49+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
5050
pub struct mozilla_Position {
5151
pub _address: u8,
5252
}
@@ -77,7 +77,7 @@ impl Default for mozilla_StyleShapeSource {
7777
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
7878
}
7979
#[repr(C)]
80-
#[derive(Debug, Copy, Hash)]
80+
#[derive(Debug, Copy, Hash, PartialEq)]
8181
pub struct Bar {
8282
pub mFoo: *mut nsFoo,
8383
}

tests/expectations/tests/typeref_1_0.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
3131
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3232
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
3333
}
34+
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
35+
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
36+
}
3437
#[repr(C)]
35-
#[derive(Debug, Default, Copy, Hash)]
38+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
3639
pub struct nsFoo {
3740
pub mBar: mozilla_StyleShapeSource,
3841
}
@@ -52,7 +55,7 @@ impl Clone for nsFoo {
5255
fn clone(&self) -> Self { *self }
5356
}
5457
#[repr(C)]
55-
#[derive(Debug, Default, Copy, Hash)]
58+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
5659
pub struct mozilla_FragmentOrURL {
5760
pub mIsLocalRef: bool,
5861
}
@@ -74,7 +77,7 @@ impl Clone for mozilla_FragmentOrURL {
7477
fn clone(&self) -> Self { *self }
7578
}
7679
#[repr(C)]
77-
#[derive(Debug, Default, Copy, Hash)]
80+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
7881
pub struct mozilla_Position {
7982
pub _address: u8,
8083
}
@@ -89,19 +92,19 @@ impl Clone for mozilla_Position {
8992
fn clone(&self) -> Self { *self }
9093
}
9194
#[repr(C)]
92-
#[derive(Debug, Default, Copy, Clone, Hash)]
95+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
9396
pub struct mozilla_StyleShapeSource {
9497
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
9598
}
9699
#[repr(C)]
97-
#[derive(Debug, Default, Copy, Clone, Hash)]
100+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
98101
pub struct mozilla_StyleShapeSource__bindgen_ty_1 {
99102
pub mPosition: __BindgenUnionField<*mut mozilla_Position>,
100103
pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>,
101104
pub bindgen_union_field: u64,
102105
}
103106
#[repr(C)]
104-
#[derive(Debug, Copy, Hash)]
107+
#[derive(Debug, Copy, Hash, PartialEq)]
105108
pub struct Bar {
106109
pub mFoo: *mut nsFoo,
107110
}

tests/expectations/tests/use-core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
extern crate core;
77

88
#[repr(C)]
9-
#[derive(Debug, Copy, Hash)]
9+
#[derive(Debug, Copy, Hash, PartialEq)]
1010
pub struct foo {
1111
pub a: ::std::os::raw::c_int,
1212
pub b: ::std::os::raw::c_int,

tests/expectations/tests/use-core_1_0.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ impl <T> ::core::fmt::Debug for __BindgenUnionField<T> {
3232
impl <T> ::core::hash::Hash for __BindgenUnionField<T> {
3333
fn hash<H: ::core::hash::Hasher>(&self, _state: &mut H) { }
3434
}
35+
impl <T> ::core::cmp::PartialEq for __BindgenUnionField<T> {
36+
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
37+
}
3538
#[repr(C)]
36-
#[derive(Debug, Copy, Hash)]
39+
#[derive(Debug, Copy, Hash, PartialEq)]
3740
pub struct foo {
3841
pub a: ::std::os::raw::c_int,
3942
pub b: ::std::os::raw::c_int,
@@ -68,7 +71,7 @@ impl Default for foo {
6871
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
6972
}
7073
#[repr(C)]
71-
#[derive(Debug, Default, Copy, Hash)]
74+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
7275
pub struct _bindgen_ty_1 {
7376
pub bar: __BindgenUnionField<::std::os::raw::c_int>,
7477
pub baz: __BindgenUnionField<::std::os::raw::c_long>,

tests/headers/16-byte-alignment.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
22

33
typedef unsigned char uint8_t;
44
typedef unsigned short uint16_t;

tests/headers/16-byte-alignment_1_0.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
22

33
typedef unsigned char uint8_t;
44
typedef unsigned short uint16_t;

tests/headers/char.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
22
//
33
typedef char Char;
44
typedef signed char SChar;

tests/headers/issue-493.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
2-
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
32
template<class _CharT, class _Traits, class _Allocator>
43
class basic_string
54
{

tests/headers/issue-493_1_0.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
22

33
template<class _CharT, class _Traits, class _Allocator>
44
class basic_string

tests/headers/typeref.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
2-
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
32
struct nsFoo;
43

54
namespace mozilla {

tests/headers/typeref_1_0.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
22

33
struct nsFoo;
44

tests/headers/use-core.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash
1+
// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
22

33
struct foo {
44
int a, b;

tests/headers/use-core_1_0.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash
1+
// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
22

33
struct foo {
44
int a, b;

0 commit comments

Comments
 (0)