Skip to content

Commit e51ee24

Browse files
committed
Add tests
1 parent 927139d commit e51ee24

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

crates/core_simd/tests/ops_macros.rs

+30
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,36 @@ macro_rules! impl_binary_checked_op_test {
9494
macro_rules! impl_common_integer_tests {
9595
{ $vector:ident, $scalar:ident } => {
9696
test_helpers::test_lanes! {
97+
fn shr<const LANES: usize>() {
98+
use core::ops::Shr;
99+
let shr = |x: $scalar, y: $scalar| x.wrapping_shr(y as _);
100+
test_helpers::test_binary_elementwise(
101+
&<$vector::<LANES> as Shr<$vector::<LANES>>>::shr,
102+
&shr,
103+
&|_, _| true,
104+
);
105+
test_helpers::test_binary_scalar_rhs_elementwise(
106+
&<$vector::<LANES> as Shr<$scalar>>::shr,
107+
&shr,
108+
&|_, _| true,
109+
);
110+
}
111+
112+
fn shl<const LANES: usize>() {
113+
use core::ops::Shl;
114+
let shl = |x: $scalar, y: $scalar| x.wrapping_shl(y as _);
115+
test_helpers::test_binary_elementwise(
116+
&<$vector::<LANES> as Shl<$vector::<LANES>>>::shl,
117+
&shl,
118+
&|_, _| true,
119+
);
120+
test_helpers::test_binary_scalar_rhs_elementwise(
121+
&<$vector::<LANES> as Shl<$scalar>>::shl,
122+
&shl,
123+
&|_, _| true,
124+
);
125+
}
126+
97127
fn reduce_sum<const LANES: usize>() {
98128
test_helpers::test_1(&|x| {
99129
test_helpers::prop_assert_biteq! (

0 commit comments

Comments
 (0)