summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiting Zhu <zhitingz@cs.utexas.edu>2017-08-16 21:26:01 -0500
committerZhiting Zhu <zhitingz@cs.utexas.edu>2017-08-21 16:14:41 -0500
commitff9d000435b84220d91347592282a76cbf4942e2 (patch)
tree080cb3c54b572fab3a0e4f7a8c059155a27ff378
parent3fc501f93fa9b5a19f97b7a7a2a3625616af7128 (diff)
Small tests for derive Eq
-rw-r--r--tests/expectations/tests/derive-hash-blacklisting.rs8
-rw-r--r--tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs6
-rw-r--r--tests/expectations/tests/derive-hash-struct-with-float-array.rs4
-rw-r--r--tests/expectations/tests/derive-hash-struct-with-pointer.rs10
-rw-r--r--tests/expectations/tests/derive-hash-template-def-float.rs4
-rw-r--r--tests/expectations/tests/derive-hash-template-inst-float.rs12
-rw-r--r--tests/headers/derive-hash-blacklisting.hpp16
-rw-r--r--tests/headers/derive-hash-struct-with-anon-struct-float.h4
-rw-r--r--tests/headers/derive-hash-struct-with-float-array.h4
-rw-r--r--tests/headers/derive-hash-struct-with-pointer.h4
-rw-r--r--tests/headers/derive-hash-template-def-float.hpp6
-rw-r--r--tests/headers/derive-hash-template-inst-float.hpp10
12 files changed, 44 insertions, 44 deletions
diff --git a/tests/expectations/tests/derive-hash-blacklisting.rs b/tests/expectations/tests/derive-hash-blacklisting.rs
index c345d1aa..d24586be 100644
--- a/tests/expectations/tests/derive-hash-blacklisting.rs
+++ b/tests/expectations/tests/derive-hash-blacklisting.rs
@@ -3,10 +3,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-#[repr(C)] #[derive(Debug, Hash, Copy, Clone)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }
+#[repr(C)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }
-/// This would derive(Hash) if it didn't contain a blacklisted type,
-/// causing us to conservatively avoid deriving hash for it.
+/// This would derive(Hash, Eq, PartialEq) if it didn't contain a blacklisted type,
+/// causing us to conservatively avoid deriving hash/Eq/PartialEq for it.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct WhitelistedOne {
@@ -30,7 +30,7 @@ impl Clone for WhitelistedOne {
impl Default for WhitelistedOne {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/// This can't derive(Hash) even if it didn't contain a blacklisted type.
+/// This can't derive(Hash/Eq) even if it didn't contain a blacklisted type.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct WhitelistedTwo {
diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
index 051a3636..3457afef 100644
--- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
@@ -4,14 +4,14 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/// A struct containing a struct containing a float that cannot derive hash.
+/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partial eq.
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, PartialEq)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, PartialEq)]
pub struct foo__bindgen_ty_1 {
pub a: f32,
pub b: f32,
diff --git a/tests/expectations/tests/derive-hash-struct-with-float-array.rs b/tests/expectations/tests/derive-hash-struct-with-float-array.rs
index bb4a6b5d..9ee6785c 100644
--- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs
@@ -4,9 +4,9 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/// A struct containing an array of floats that cannot derive hash.
+/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq.
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, PartialEq)]
pub struct foo {
pub bar: [f32; 3usize],
}
diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
index a11d738f..c29f9b1e 100644
--- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
@@ -4,9 +4,9 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/// Pointers can derive hash/PartialEq
+/// Pointers can derive hash/PartialEq/Eq
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct ConstPtrMutObj {
pub bar: *const ::std::os::raw::c_int,
}
@@ -29,7 +29,7 @@ impl Default for ConstPtrMutObj {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct MutPtrMutObj {
pub bar: *mut ::std::os::raw::c_int,
}
@@ -52,7 +52,7 @@ impl Default for MutPtrMutObj {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct MutPtrConstObj {
pub bar: *const ::std::os::raw::c_int,
}
@@ -75,7 +75,7 @@ impl Default for MutPtrConstObj {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct ConstPtrConstObj {
pub bar: *const ::std::os::raw::c_int,
}
diff --git a/tests/expectations/tests/derive-hash-template-def-float.rs b/tests/expectations/tests/derive-hash-template-def-float.rs
index e1d7836c..23bf702d 100644
--- a/tests/expectations/tests/derive-hash-template-def-float.rs
+++ b/tests/expectations/tests/derive-hash-template-def-float.rs
@@ -4,9 +4,9 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/// Template definition containing a float, which cannot derive hash.
+/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq.
#[repr(C)]
-#[derive(Debug, Copy, Clone)]
+#[derive(Debug, Copy, Clone, PartialEq)]
pub struct foo<T> {
pub data: T,
pub b: f32,
diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs
index dd18053f..58848f87 100644
--- a/tests/expectations/tests/derive-hash-template-inst-float.rs
+++ b/tests/expectations/tests/derive-hash-template-inst-float.rs
@@ -4,9 +4,9 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/// Template definition that doesn't contain float can derive hash
+/// Template definition that doesn't contain float can derive hash/partialeq/eq
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo<T> {
pub data: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -14,9 +14,9 @@ pub struct foo<T> {
impl <T> Default for foo<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/// Can derive hash when instantiated with int
+/// Can derive hash/partialeq/eq when instantiated with int
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq, Eq)]
pub struct IntStr {
pub a: foo<::std::os::raw::c_int>,
}
@@ -38,9 +38,9 @@ impl Clone for IntStr {
impl Default for IntStr {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/// Cannot derive hash when instantiated with float
+/// Cannot derive hash/eq when instantiated with float but can derive partialeq
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, PartialEq)]
pub struct FloatStr {
pub a: foo<f32>,
}
diff --git a/tests/headers/derive-hash-blacklisting.hpp b/tests/headers/derive-hash-blacklisting.hpp
index ee819c17..c39c31ad 100644
--- a/tests/headers/derive-hash-blacklisting.hpp
+++ b/tests/headers/derive-hash-blacklisting.hpp
@@ -1,17 +1,17 @@
-// bindgen-flags: --with-derive-hash --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }"
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }"
//
-template<class T>
+template <class T>
struct Blacklisted {
- T t;
+ T t;
};
-/// This would derive(Hash) if it didn't contain a blacklisted type,
-/// causing us to conservatively avoid deriving hash for it.
+/// This would derive(Hash, Eq, PartialEq) if it didn't contain a blacklisted type,
+/// causing us to conservatively avoid deriving hash/Eq/PartialEq for it.
struct WhitelistedOne {
- Blacklisted<int> a;
+ Blacklisted<int> a;
};
-/// This can't derive(Hash) even if it didn't contain a blacklisted type.
+/// This can't derive(Hash/Eq) even if it didn't contain a blacklisted type.
struct WhitelistedTwo {
- Blacklisted<float> b;
+ Blacklisted<float> b;
};
diff --git a/tests/headers/derive-hash-struct-with-anon-struct-float.h b/tests/headers/derive-hash-struct-with-anon-struct-float.h
index 2b76cd23..64fe7fd9 100644
--- a/tests/headers/derive-hash-struct-with-anon-struct-float.h
+++ b/tests/headers/derive-hash-struct-with-anon-struct-float.h
@@ -1,6 +1,6 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
//
-/// A struct containing a struct containing a float that cannot derive hash.
+/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partial eq.
struct foo {
struct {
float a;
diff --git a/tests/headers/derive-hash-struct-with-float-array.h b/tests/headers/derive-hash-struct-with-float-array.h
index 53f0c79d..a34904f7 100644
--- a/tests/headers/derive-hash-struct-with-float-array.h
+++ b/tests/headers/derive-hash-struct-with-float-array.h
@@ -1,6 +1,6 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
//
-/// A struct containing an array of floats that cannot derive hash.
+/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq.
struct foo {
float bar[3];
};
diff --git a/tests/headers/derive-hash-struct-with-pointer.h b/tests/headers/derive-hash-struct-with-pointer.h
index ed5199d4..d7f18a6d 100644
--- a/tests/headers/derive-hash-struct-with-pointer.h
+++ b/tests/headers/derive-hash-struct-with-pointer.h
@@ -1,6 +1,6 @@
-// bindgen-flags: --with-derive-hash --with-derive-partialeq
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
//
-/// Pointers can derive hash/PartialEq
+/// Pointers can derive hash/PartialEq/Eq
struct ConstPtrMutObj {
int* const bar;
};
diff --git a/tests/headers/derive-hash-template-def-float.hpp b/tests/headers/derive-hash-template-def-float.hpp
index 28885ed1..8c1a14d1 100644
--- a/tests/headers/derive-hash-template-def-float.hpp
+++ b/tests/headers/derive-hash-template-def-float.hpp
@@ -1,7 +1,7 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
//
-/// Template definition containing a float, which cannot derive hash.
-template<typename T>
+/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq.
+template <typename T>
struct foo {
T data;
float b;
diff --git a/tests/headers/derive-hash-template-inst-float.hpp b/tests/headers/derive-hash-template-inst-float.hpp
index 59af69bd..14fd89a0 100644
--- a/tests/headers/derive-hash-template-inst-float.hpp
+++ b/tests/headers/derive-hash-template-inst-float.hpp
@@ -1,17 +1,17 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
//
-/// Template definition that doesn't contain float can derive hash
-template<typename T>
+/// Template definition that doesn't contain float can derive hash/partialeq/eq
+template <typename T>
struct foo {
T data;
};
-/// Can derive hash when instantiated with int
+/// Can derive hash/partialeq/eq when instantiated with int
struct IntStr {
foo<int> a;
};
-/// Cannot derive hash when instantiated with float
+/// Cannot derive hash/eq when instantiated with float but can derive partialeq
struct FloatStr {
foo<float> a;
};