aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
+}