diff options
Diffstat (limited to '')
-rw-r--r-- | vendor/packed_simd_2/src/testing.rs | 2 | ||||
-rw-r--r-- | vendor/packed_simd_2/src/testing/macros.rs | 40 | ||||
-rw-r--r-- | vendor/packed_simd_2/src/testing/utils.rs | 34 |
3 files changed, 32 insertions, 44 deletions
diff --git a/vendor/packed_simd_2/src/testing.rs b/vendor/packed_simd_2/src/testing.rs index fcbcf9e2a..6320b2805 100644 --- a/vendor/packed_simd_2/src/testing.rs +++ b/vendor/packed_simd_2/src/testing.rs @@ -5,4 +5,4 @@ mod macros; #[cfg(test)] #[macro_use] -crate mod utils; +pub(crate) mod utils; diff --git a/vendor/packed_simd_2/src/testing/macros.rs b/vendor/packed_simd_2/src/testing/macros.rs index 6008634c7..7bc4268b9 100644 --- a/vendor/packed_simd_2/src/testing/macros.rs +++ b/vendor/packed_simd_2/src/testing/macros.rs @@ -3,26 +3,26 @@ macro_rules! test_if { ($cfg_tt:tt: $it:item) => { #[cfg(any( - // Test everything if: - // - // * tests are enabled, - // * no features about exclusively testing - // specific vector classes are enabled - all(test, not(any( - test_v16, - test_v32, - test_v64, - test_v128, - test_v256, - test_v512, - test_none, // disables all tests - ))), - // Test if: - // - // * tests are enabled - // * a particular cfg token tree returns true - all(test, $cfg_tt), - ))] + // Test everything if: + // + // * tests are enabled, + // * no features about exclusively testing + // specific vector classes are enabled + all(test, not(any( + test_v16, + test_v32, + test_v64, + test_v128, + test_v256, + test_v512, + test_none, // disables all tests + ))), + // Test if: + // + // * tests are enabled + // * a particular cfg token tree returns true + all(test, $cfg_tt), + ))] $it }; } diff --git a/vendor/packed_simd_2/src/testing/utils.rs b/vendor/packed_simd_2/src/testing/utils.rs index 21f27aae5..7d8f39573 100644 --- a/vendor/packed_simd_2/src/testing/utils.rs +++ b/vendor/packed_simd_2/src/testing/utils.rs @@ -7,16 +7,15 @@ use crate::{cmp::PartialOrd, fmt::Debug, LexicographicallyOrdered}; /// Tests PartialOrd for `a` and `b` where `a < b` is true. -pub fn test_lt<T>( - a: LexicographicallyOrdered<T>, b: LexicographicallyOrdered<T>, -) where +pub fn test_lt<T>(a: LexicographicallyOrdered<T>, b: LexicographicallyOrdered<T>) +where LexicographicallyOrdered<T>: Debug + PartialOrd, { assert!(a < b, "{:?}, {:?}", a, b); assert!(b > a, "{:?}, {:?}", a, b); assert!(!(a == b), "{:?}, {:?}", a, b); - assert!(a != b, "{:?}, {:?}", a, b); + assert_ne!(a, b, "{:?}, {:?}", a, b); assert!(a <= b, "{:?}, {:?}", a, b); assert!(b >= a, "{:?}, {:?}", a, b); @@ -37,9 +36,8 @@ pub fn test_lt<T>( } /// Tests PartialOrd for `a` and `b` where `a <= b` is true. -pub fn test_le<T>( - a: LexicographicallyOrdered<T>, b: LexicographicallyOrdered<T>, -) where +pub fn test_le<T>(a: LexicographicallyOrdered<T>, b: LexicographicallyOrdered<T>) +where LexicographicallyOrdered<T>: Debug + PartialOrd, { assert!(a <= b, "{:?}, {:?}", a, b); @@ -54,14 +52,15 @@ pub fn test_le<T>( assert!(!(a != b), "{:?}, {:?}", a, b); } else { - assert!(a != b, "{:?}, {:?}", a, b); + assert_ne!(a, b, "{:?}, {:?}", a, b); test_lt(a, b); } } /// Test PartialOrd::partial_cmp for `a` and `b` returning `Ordering` pub fn test_cmp<T>( - a: LexicographicallyOrdered<T>, b: LexicographicallyOrdered<T>, + a: LexicographicallyOrdered<T>, + b: LexicographicallyOrdered<T>, o: Option<crate::cmp::Ordering>, ) where LexicographicallyOrdered<T>: PartialOrd + Debug, @@ -72,18 +71,8 @@ pub fn test_cmp<T>( let mut arr_a: [T::Element; 64] = [Default::default(); 64]; let mut arr_b: [T::Element; 64] = [Default::default(); 64]; - unsafe { - crate::ptr::write_unaligned( - arr_a.as_mut_ptr() as *mut LexicographicallyOrdered<T>, - a, - ) - } - unsafe { - crate::ptr::write_unaligned( - arr_b.as_mut_ptr() as *mut LexicographicallyOrdered<T>, - b, - ) - } + unsafe { crate::ptr::write_unaligned(arr_a.as_mut_ptr() as *mut LexicographicallyOrdered<T>, a) } + unsafe { crate::ptr::write_unaligned(arr_b.as_mut_ptr() as *mut LexicographicallyOrdered<T>, b) } let expected = arr_a[0..T::LANES].partial_cmp(&arr_b[0..T::LANES]); let result = a.partial_cmp(&b); assert_eq!(expected, result, "{:?}, {:?}", a, b); @@ -134,8 +123,7 @@ macro_rules! ptr_vals { // all bits cleared let clear: <$id as sealed::Simd>::Element = crate::mem::zeroed(); // all bits set - let set: <$id as sealed::Simd>::Element = - crate::mem::transmute(-1_isize); + let set: <$id as sealed::Simd>::Element = crate::mem::transmute(-1_isize); (clear, set) } }; |