aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/math/modulus.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/math/modulus.lux9
1 files changed, 7 insertions, 2 deletions
diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux
index 58d16666f..7fec2db0d 100644
--- a/stdlib/source/test/lux/math/modulus.lux
+++ b/stdlib/source/test/lux/math/modulus.lux
@@ -25,14 +25,19 @@
0 +1
_ (.int divisor)))))))
+(def: #export (random range)
+ (Ex [%] (-> Int (Random (/.Modulus %))))
+ (|> random.int
+ (\ random.monad map (i.% range))
+ (random.one (|>> /.modulus try.to_maybe))))
+
(def: #export test
Test
(<| (_.covering /._)
(_.for [/.Modulus])
(do random.monad
[divisor random.int
- modulus (random.one (|>> /.modulus try.to_maybe)
- random.int)
+ modulus (..random +1,000,000)
dividend random.int]
($_ _.and
(_.cover [/.modulus /.divisor]