diff options
author | inoas <mail@inoas.com> | 2022-04-12 17:23:52 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-04-16 10:23:34 +0100 |
commit | c13cc8b423b3ef297edb745b91d2c628d842d263 (patch) | |
tree | e5248cb44768482701fdf2a333ea71e96de64c96 /test | |
parent | c32eec844d83feb0db0b69730cf2922f498bf921 (diff) | |
download | gleam_stdlib-c13cc8b423b3ef297edb745b91d2c628d842d263.tar.gz gleam_stdlib-c13cc8b423b3ef297edb745b91d2c628d842d263.zip |
wip
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/float_test.gleam | 30 | ||||
-rw-r--r-- | test/gleam/int_test.gleam | 10 |
2 files changed, 23 insertions, 17 deletions
diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam index 65878bf..e13112f 100644 --- a/test/gleam/float_test.gleam +++ b/test/gleam/float_test.gleam @@ -335,7 +335,12 @@ pub fn random_between_test() { |> fn(x) { x >=. 0.0 && x <. 1.0 } |> should.be_true + float.random_between(1.0, 0.0) + |> fn(x) { x >=. 0.0 && x <. 1.0 } + |> should.be_true + float.random_between(0.0, -1.0) + |> function.tap(io.debug) |> fn(x) { x >=. -1.0 && x <. 0.0 } |> should.be_true @@ -343,12 +348,20 @@ pub fn random_between_test() { |> 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 } + 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(-2.0, 0.0) - |> fn(x) { x >=. -2.0 && x <. 0.0 } + 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 } @@ -370,11 +383,14 @@ pub fn random_to_test() { |> fn(x) { x >=. 0.0 && x <. 1.0 } |> should.be_true - float.random_to(2.0) - |> fn(x) { x >=. 0.0 && x <. 2.0 } + float.random_to(10.0) + |> fn(x) { x >=. 0.0 && x <. 10.0 } |> should.be_true - } + float.random_to(-10.0) + |> fn(x) { x >=. -10.0 && x <. 0.0 } + |> should.be_true + } list.range(0, 100) |> iterator.from_list |> iterator.fold(Nil, one_random_to_test_set) diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam index aeec7e7..017596a 100644 --- a/test/gleam/int_test.gleam +++ b/test/gleam/int_test.gleam @@ -323,20 +323,16 @@ pub fn random_between_test() { let one_random_between_test_set = 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 } - list.range(0, 100) |> iterator.from_list |> iterator.fold(Nil, one_random_between_test_set) @@ -346,28 +342,22 @@ pub fn random_to_test() { let one_random_to_test_set = fn(_acc, _e) { int.random_to(0) |> should.equal(0) - int.random_to(-1) |> list.contains([-1], _) |> should.be_true - int.random_to(1) |> list.contains([0], _) |> should.be_true - int.random_to(2) |> list.contains([0, 1], _) |> should.be_true - int.random_to(3) |> list.contains([0, 1, 2], _) |> should.be_true - int.random_to(4) |> list.contains([0, 1, 2, 3], _) |> should.be_true } - list.range(0, 100) |> iterator.from_list |> iterator.fold(Nil, one_random_to_test_set) |