aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gleam/iterator_test.gleam12
-rw-r--r--test/gleam/list_test.gleam10
2 files changed, 22 insertions, 0 deletions
diff --git a/test/gleam/iterator_test.gleam b/test/gleam/iterator_test.gleam
index 49c65fe..0c85ede 100644
--- a/test/gleam/iterator_test.gleam
+++ b/test/gleam/iterator_test.gleam
@@ -305,3 +305,15 @@ pub fn chunk_test() {
|> iterator.to_list
|> should.equal([[1], [2, 2], [3], [4, 4, 6], [7, 7]])
}
+
+pub fn sized_chunk_test() {
+ iterator.from_list([1, 2, 3, 4, 5, 6])
+ |> iterator.sized_chunk(into: 2)
+ |> iterator.to_list
+ |> should.equal([[1, 2], [3, 4], [5, 6]])
+
+ iterator.from_list([1, 2, 3, 4, 5, 6, 7, 8])
+ |> iterator.sized_chunk(into: 3)
+ |> iterator.to_list
+ |> should.equal([[1, 2, 3], [4, 5, 6], [7, 8]])
+}
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index 8c414a8..b561d33 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -596,3 +596,13 @@ pub fn chunk_test() {
|> list.chunk(by: fn(n) { n % 2 })
|> should.equal([[1], [2, 2], [3], [4, 4, 6], [7, 7]])
}
+
+pub fn sized_chunk_test() {
+ [1, 2, 3, 4, 5, 6]
+ |> list.sized_chunk(into: 2)
+ |> should.equal([[1, 2], [3, 4], [5, 6]])
+
+ [1, 2, 3, 4, 5, 6, 7, 8]
+ |> list.sized_chunk(into: 3)
+ |> should.equal([[1, 2, 3], [4, 5, 6], [7, 8]])
+}