Validate num_splits in split (#3234)
Co-authored-by: KD2YCU <[email protected]>
This commit is contained in:
@@ -415,6 +415,10 @@ TEST_CASE("test split") {
|
||||
array x = array(1);
|
||||
CHECK_THROWS(split(x, 0));
|
||||
|
||||
// Regression: non-scalar split with num_splits <= 0
|
||||
CHECK_THROWS(split(array({0, 1, 2, 3, 4, 5}), 0));
|
||||
CHECK_THROWS(split(array({0, 1, 2, 3, 4, 5}), -1));
|
||||
|
||||
x = array({3});
|
||||
CHECK_EQ(split(x, 1)[0].item<int>(), 3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user