aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGiacomo Cavalieri <giacomo.cavalieri@icloud.com>2024-10-10 11:14:06 +0200
committerLouis Pilfold <louis@lpil.uk>2024-10-10 15:03:25 +0100
commitd50ac221d9902392f2ba3d9402d72954673ffd4a (patch)
tree97d397de23b54a2ee8932e21b6d57652ee458502 /test
parent4c3ea2086cf7662f79628f26abff15307ff5bce9 (diff)
downloadgleam_stdlib-d50ac221d9902392f2ba3d9402d72954673ffd4a.tar.gz
gleam_stdlib-d50ac221d9902392f2ba3d9402d72954673ffd4a.zip
remove iterators from tests
Diffstat (limited to 'test')
-rw-r--r--test/gleam/float_test.gleam4
-rw-r--r--test/gleam/int_test.gleam40
2 files changed, 19 insertions, 25 deletions
diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam
index 6a737e7..0d979e8 100644
--- a/test/gleam/float_test.gleam
+++ b/test/gleam/float_test.gleam
@@ -1,6 +1,5 @@
import gleam/float
import gleam/int
-import gleam/iterator
import gleam/list
import gleam/order
import gleam/result
@@ -392,8 +391,7 @@ pub fn random_test() {
let iterations = 10_000
let sum =
list.range(0, iterations)
- |> iterator.from_list()
- |> iterator.fold(from: 0.0, with: fn(accumulator, _element) {
+ |> list.fold(from: 0.0, with: fn(accumulator, _element) {
let i = float.random()
{ i <. 1.0 }
diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam
index f9b92dd..c7dd6c7 100644
--- a/test/gleam/int_test.gleam
+++ b/test/gleam/int_test.gleam
@@ -1,5 +1,4 @@
import gleam/int
-import gleam/iterator
import gleam/list
import gleam/order
import gleam/should
@@ -393,27 +392,24 @@ pub fn undigits_test() {
}
pub fn random_test() {
- let test_boundaries = fn(_accumulator, _element) {
- int.random(0)
- |> should.equal(0)
-
- int.random(1)
- |> should.equal(0)
-
- int.random(-1)
- |> should.equal(-1)
-
- int.random(2)
- |> list.contains([0, 1], _)
- |> should.be_true
-
- int.random(3)
- |> list.contains([0, 1, 2], _)
- |> should.be_true
- }
- list.range(0, 100)
- |> iterator.from_list
- |> iterator.fold(Nil, test_boundaries)
+ use _ <- list.each(list.range(0, 100))
+
+ int.random(0)
+ |> should.equal(0)
+
+ int.random(1)
+ |> should.equal(0)
+
+ int.random(-1)
+ |> should.equal(-1)
+
+ int.random(2)
+ |> list.contains([0, 1], _)
+ |> should.be_true
+
+ int.random(3)
+ |> list.contains([0, 1, 2], _)
+ |> should.be_true
}
pub fn divide_test() {