Skip to content

Commit cf95ef9

Browse files
jonasBossbluss
authored andcommitted
add a test for zipping axis_windows with a 1d array
1 parent 4c26e16 commit cf95ef9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/windows.rs

+16
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,22 @@ fn test_axis_windows_3d()
278278
]);
279279
}
280280

281+
#[test]
282+
fn tests_axis_windows_3d_zips_with_1d()
283+
{
284+
let a = Array::from_iter(0..27)
285+
.into_shape_with_order((3, 3, 3))
286+
.unwrap();
287+
let mut b = Array::zeros(2);
288+
289+
Zip::from(b.view_mut())
290+
.and(a.axis_windows(Axis(1), 2))
291+
.for_each(|b, a| {
292+
*b = a.sum();
293+
});
294+
assert_eq!(b,arr1(&[207, 261]));
295+
}
296+
281297
#[test]
282298
fn test_window_neg_stride()
283299
{

0 commit comments

Comments
 (0)