Validate num_splits in split (#3234)

Co-authored-by: KD2YCU <[email protected]>
This commit is contained in:
Dan Anderson
2026-03-09 21:47:08 -07:00
committed by GitHub
co-authored by KD2YCU
parent 5a347b2ec8
commit a25399cbd4
3 changed files with 30 additions and 1 deletions
+4
View File
@@ -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);