aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorinoas <mail@inoas.com>2022-04-12 21:41:17 +0200
committerLouis Pilfold <louis@lpil.uk>2022-04-16 10:23:34 +0100
commit620a564dbd0fc75f66ec2abcbbac5a56543cb5c5 (patch)
tree55216850a4db9e52f1395fc043800b328251d8bc /test
parent6a345a4c0b18ce2f0ade80a99186518579898fc9 (diff)
downloadgleam_stdlib-620a564dbd0fc75f66ec2abcbbac5a56543cb5c5.tar.gz
gleam_stdlib-620a564dbd0fc75f66ec2abcbbac5a56543cb5c5.zip
cleanup
Diffstat (limited to 'test')
-rw-r--r--test/gleam/float_test.gleam10
-rw-r--r--test/gleam/int_test.gleam4
2 files changed, 9 insertions, 5 deletions
diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam
index 35675f9..0cfd994 100644
--- a/test/gleam/float_test.gleam
+++ b/test/gleam/float_test.gleam
@@ -353,26 +353,29 @@ pub fn random_uniform_test() {
pub fn random_between_test() {
let test_boundaries = fn(_acc, _e) {
- float.random_between(-10.0, 0.0)
- |> fn(x) { x >=. -10.0 && x <. 0.0 }
- |> should.be_true
float.random_between(0.0, 0.0)
|> should.equal(0.0)
+
float.random_between(0.0, 10.0)
|> fn(x) { x >=. 0.0 && x <. 10.0 }
|> should.be_true
+
float.random_between(10.0, 0.0)
|> fn(x) { x >=. 0.0 && x <. 10.0 }
|> should.be_true
+
float.random_between(0.0, -10.0)
|> fn(x) { x >=. -10.0 && x <. 0.0 }
|> should.be_true
+
float.random_between(-10.0, 0.0)
|> fn(x) { x >=. -10.0 && x <. 0.0 }
|> should.be_true
+
float.random_between(-10.0, 10.0)
|> fn(x) { x >=. -10.0 && x <. 10.0 }
|> should.be_true
+
float.random_between(10.0, -10.0)
|> fn(x) { x >=. -10.0 && x <. 10.0 }
|> should.be_true
@@ -395,7 +398,6 @@ pub fn random_between_test() {
with: fn(acc, _element) { acc +. float.random_between(min, max) },
)
|> fn(sum) { sum /. int.to_float(iterations) }
- // |> function.tap(fn(sum) { should.equal(sum, expected_average) })
|> float.loosely_compare(expected_average, tolerance)
|> should.equal(order.Eq)
}
diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam
index 510e166..7f923d9 100644
--- a/test/gleam/int_test.gleam
+++ b/test/gleam/int_test.gleam
@@ -350,12 +350,15 @@ pub fn random_between_test() {
let test_boundaries = fn(_acc, _e) {
int.random_between(0, 0)
|> should.equal(0)
+
int.random_between(-1, 0)
|> list.contains([-1, 0], _)
|> should.be_true
+
int.random_between(-1, 1)
|> list.contains([-1, 0], _)
|> should.be_true
+
int.random_between(-1, 2)
|> list.contains([-1, 0, 1], _)
|> should.be_true
@@ -373,7 +376,6 @@ pub fn random_between_test() {
with: fn(acc, _element) { acc + int.random_between(min, max) },
)
|> fn(sum) { sum / iterations }
- // |> function.tap(fn(sum) { should.equal(sum, expected_average) })
|> fn(sum) {
sum - tolerance <= expected_average || sum + tolerance >= expected_average
}