Skip to content

Commit 94e6364

Browse files
committed
TEST: Add a few more test cases for concatenate
1 parent 9bb7347 commit 94e6364

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/stacking.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use ndarray::{arr2, arr3, aview1, concatenate, stack, Array2, Axis, ErrorKind, Ix1};
1+
use ndarray::{arr2, arr3, aview1, aview2, concatenate, stack, Array2, Axis, ErrorKind, Ix1};
22

33
#[test]
44
fn concatenating() {
@@ -15,6 +15,13 @@ fn concatenating() {
1515
let d = concatenate![Axis(0), a.row(0), &[9., 9.]];
1616
assert_eq!(d, aview1(&[2., 2., 9., 9.]));
1717

18+
let d = concatenate![Axis(1), a.row(0).insert_axis(Axis(1)), aview1(&[9., 9.]).insert_axis(Axis(1))];
19+
assert_eq!(d, aview2(&[[2., 9.],
20+
[2., 9.]]));
21+
22+
let d = concatenate![Axis(0), a.row(0).insert_axis(Axis(1)), aview1(&[9., 9.]).insert_axis(Axis(1))];
23+
assert_eq!(d.t(), aview2(&[[2., 2., 9., 9.]]));
24+
1825
let res = ndarray::concatenate(Axis(1), &[a.view(), c.view()]);
1926
assert_eq!(res.unwrap_err().kind(), ErrorKind::IncompatibleShape);
2027

0 commit comments

Comments
 (0)