Skip to content

Commit b0c7adf

Browse files
sqrewGemini-CLI
andcommitted
test(Array): add missing tests for Array module
Adds tests for rest, zero, sum-length, partition, copy-filter, and unsafe-nth-value. Co-Authored-By: Gemini-CLI <gemini-cli@google.com>
1 parent 551c57d commit b0c7adf

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

test/array.carp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,4 +375,32 @@
375375
(the (Array Int) [])
376376
(drop-while &(fn [x] (< @x 10)) &[1 2 3])
377377
"drop-while returns empty when all elements match")
378+
(assert-ref-equal test
379+
[2 3]
380+
(rest &[1 2 3])
381+
"rest works as expected")
382+
(assert-ref-equal test
383+
(the (Array Int) [])
384+
(zero)
385+
"zero works as expected")
386+
(assert-equal test
387+
6
388+
(sum-length &[[1] [2 3] [4 5 6]])
389+
"sum-length works as expected")
390+
(assert-ref-equal test
391+
[[1 2] [3 4] [5 6]]
392+
(partition &[1 2 3 4 5 6] 2)
393+
"partition into chunks of 2")
394+
(assert-ref-equal test
395+
[[1 2 3] [4 5 6]]
396+
(partition &[1 2 3 4 5 6] 3)
397+
"partition into chunks of 3")
398+
(assert-ref-equal test
399+
[2 4 6]
400+
(copy-filter &(fn [x] (Int.even? @x)) &[1 2 3 4 5 6])
401+
"copy-filter works as expected")
402+
(assert-equal test
403+
42
404+
(unsafe-nth-value &[42 43] 0)
405+
"unsafe-nth-value works as expected")
378406
)

0 commit comments

Comments
 (0)