aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorinoas <mail@inoas.com>2022-04-12 03:10:28 +0200
committerLouis Pilfold <louis@lpil.uk>2022-04-16 10:23:34 +0100
commitc32eec844d83feb0db0b69730cf2922f498bf921 (patch)
treeff010ad0cd497210dc09322a92c839fcfebd81f8 /test
parent7f1c0f03b4e825fe86fe1d49a8017bf4c4bcb7bb (diff)
downloadgleam_stdlib-c32eec844d83feb0db0b69730cf2922f498bf921.tar.gz
gleam_stdlib-c32eec844d83feb0db0b69730cf2922f498bf921.zip
readd int tests
Diffstat (limited to 'test')
-rw-r--r--test/gleam/int_test.gleam96
1 files changed, 54 insertions, 42 deletions
diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam
index b7a425b..aeec7e7 100644
--- a/test/gleam/int_test.gleam
+++ b/test/gleam/int_test.gleam
@@ -318,45 +318,57 @@ pub fn undigits_test() {
int.undigits([1, 1, 2], 2)
|> should.equal(Error(int.InvalidBase))
}
-// 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)
-// }
-// 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)
-// }
+
+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)
+}
+
+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)
+}