aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gleam/float_test.gleam99
1 files changed, 50 insertions, 49 deletions
diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam
index 39fa9a8..65878bf 100644
--- a/test/gleam/float_test.gleam
+++ b/test/gleam/float_test.gleam
@@ -327,54 +327,55 @@ pub fn random_uniform_test() {
}
pub fn random_between_test() {
- // let one_random_between_test_set = fn(_acc, _e) {
- // float.random_between(0.0, 0.0)
- // |> should.equal(0.0)
- // }
- float.random_between(-1.0, 0.0)
- |> function.tap(io.debug)
- // |> function.tap(fn(x) {
- // fn(x) { x >=. -1.0 }(x)
- // |> should.be_true
- // })
- |> function.tap(fn(x) {
- fn(x) { x <. 0.0 }(x)
+ let one_random_between_test_set = fn(_acc, _e) {
+ float.random_between(0.0, 0.0)
+ |> should.equal(0.0)
+
+ float.random_between(0.0, 1.0)
+ |> fn(x) { x >=. 0.0 && x <. 1.0 }
+ |> should.be_true
+
+ float.random_between(0.0, -1.0)
+ |> fn(x) { x >=. -1.0 && x <. 0.0 }
+ |> should.be_true
+
+ float.random_between(-1.0, 0.0)
+ |> fn(x) { x >=. -1.0 && x <. 0.0 }
+ |> should.be_true
+
+ float.random_between(0.0, -2.0)
+ |> fn(x) { x >=. -2.0 && x <. 0.0 }
|> should.be_true
- })
- // float.random_between(0.0, -1.0)
- // |> fn(x) { x >=. -1.0 && x <. 0.0 }
- // |> should.be_true
- // float.random_between(-1.0, 1.0)
- // |> fn(x) { x >=. -1.0 && x <. 1.0 }
- // |> should.be_true
- // float.random_between(1.0, -1.0)
- // |> fn(x) { x >=. -1.0 && x <. 1.0 }
- // |> should.be_true
- // float.random_between(-1.0, 2.0)
- // |> fn(x) { x >=. -1.0 && x <. 2.0 }
- // |> should.be_true
- // float.random_between(2.0, -1.0)
- // |> fn(x) { x >=. -1.0 && x <. 2.0 }
- // |> should.be_true
- // list.range(0, 1)
- // |> iterator.from_list
- // |> iterator.fold(Nil, one_random_between_test_set)
+
+ float.random_between(-2.0, 0.0)
+ |> fn(x) { x >=. -2.0 && x <. 0.0 }
+ |> should.be_true
+ }
+
+ list.range(0, 100)
+ |> iterator.from_list
+ |> iterator.fold(Nil, one_random_between_test_set)
+}
+
+pub fn random_to_test() {
+ let one_random_to_test_set = fn(_acc, _e) {
+ float.random_to(0.0)
+ |> should.equal(0.0)
+
+ float.random_to(-1.0)
+ |> fn(x) { x >=. -1.0 && x <. 0.0 }
+ |> should.be_true
+
+ float.random_to(1.0)
+ |> fn(x) { x >=. 0.0 && x <. 1.0 }
+ |> should.be_true
+
+ float.random_to(2.0)
+ |> fn(x) { x >=. 0.0 && x <. 2.0 }
+ |> should.be_true
+ }
+
+ list.range(0, 100)
+ |> iterator.from_list
+ |> iterator.fold(Nil, one_random_to_test_set)
}
-// pub fn random_to_test() {
-// let one_random_to_test_set = fn(_acc, _e) {
-// float.random_to(0.0)
-// |> should.equal(0.0)
-// float.random_to(-1.0)
-// |> fn(x) { x >=. -1.0 && x <. 0.0 }
-// |> should.be_true
-// float.random_to(1.0)
-// |> fn(x) { x >=. 0.0 && x <. 1.0 }
-// |> should.be_true
-// float.random_to(2.0)
-// |> fn(x) { x >=. 0.0 && x <. 2.0 }
-// |> should.be_true
-// }
-// list.range(0, 100)
-// |> iterator.from_list
-// |> iterator.fold(Nil, one_random_to_test_set)
-// }