Skip to content

Commit f797045

Browse files
committed
shape: Add more reshape_dim test cases
1 parent e896df1 commit f797045

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/dimension/reshape.rs

+14
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,19 @@ fn test_reshape() {
222222
// broadcast shapes
223223
test_reshape!(ok C from [3, 4, 5, 7], [0, 0, 7, 1], to [12, 35], [0, 1]);
224224
test_reshape!(fail C from [3, 4, 5, 7], [0, 0, 7, 1], to [28, 15]);
225+
226+
// one-filled shapes
227+
test_reshape!(ok C from [10], [1], to [1, 10, 1, 1, 1], [1, 1, 1, 1, 1]);
228+
test_reshape!(ok F from [10], [1], to [1, 10, 1, 1, 1], [1, 1, 1, 1, 1]);
229+
test_reshape!(ok C from [1, 10], [10, 1], to [1, 10, 1, 1, 1], [10, 1, 1, 1, 1]);
230+
test_reshape!(ok F from [1, 10], [10, 1], to [1, 10, 1, 1, 1], [10, 1, 1, 1, 1]);
231+
test_reshape!(ok C from [1, 10], [1, 1], to [1, 5, 1, 1, 2], [1, 2, 2, 2, 1]);
232+
test_reshape!(ok F from [1, 10], [1, 1], to [1, 5, 1, 1, 2], [1, 1, 5, 5, 5]);
233+
test_reshape!(ok C from [10, 1, 1, 1, 1], [1, 1, 1, 1, 1], to [10], [1]);
234+
test_reshape!(ok F from [10, 1, 1, 1, 1], [1, 1, 1, 1, 1], to [10], [1]);
235+
test_reshape!(ok C from [1, 5, 1, 2, 1], [1, 2, 1, 1, 1], to [10], [1]);
236+
test_reshape!(fail F from [1, 5, 1, 2, 1], [1, 2, 1, 1, 1], to [10]);
237+
test_reshape!(ok F from [1, 5, 1, 2, 1], [1, 1, 1, 5, 1], to [10], [1]);
238+
test_reshape!(fail C from [1, 5, 1, 2, 1], [1, 1, 1, 5, 1], to [10]);
225239
}
226240

0 commit comments

Comments
 (0)