aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/math.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/math.lux30
1 files changed, 17 insertions, 13 deletions
diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux
index d9741e6ad..a8c7c121e 100644
--- a/stdlib/source/test/lux/math.lux
+++ b/stdlib/source/test/lux/math.lux
@@ -2,19 +2,21 @@
[lux #*
["%" data/text/format (#+ format)]
["_" test (#+ Test)]
- ["r" math/random (#+ Random)]
- [abstract/monad (#+ Monad do)]
- [data
+ [abstract
+ [monad (#+ do)]]
+ [math
+ ["." random (#+ Random)]
[number
["n" nat]
- ["." int]
- ["f" frac]]]]
+ ["f" frac]
+ ["." int]]]]
{1
["." /]}
["." / #_
["#." infix]
["#." modulus]
["#." modular]
+ ["#." number]
["#." logic #_
["#/." continuous]
["#/." fuzzy]]])
@@ -36,8 +38,8 @@
(<| (_.context (%.name (name_of /._)))
($_ _.and
(<| (_.context "Trigonometry")
- (do {! r.monad}
- [angle (|> r.safe_frac (\ ! map (f.* /.tau)))]
+ (do {! random.monad}
+ [angle (|> random.safe_frac (\ ! map (f.* /.tau)))]
($_ _.and
(_.test "Sine and arc-sine are inverse functions."
(trigonometric_symmetry /.sin /.asin angle))
@@ -47,8 +49,8 @@
(trigonometric_symmetry /.tan /.atan angle))
)))
(<| (_.context "Rounding")
- (do {! r.monad}
- [sample (|> r.safe_frac (\ ! map (f.* +1000.0)))]
+ (do {! random.monad}
+ [sample (|> random.safe_frac (\ ! map (f.* +1000.0)))]
($_ _.and
(_.test "The ceiling will be an integer value, and will be >= the original."
(let [ceil'd (/.ceil sample)]
@@ -66,13 +68,13 @@
(f.<= +1.0 (f.abs (f.- sample round'd))))))
)))
(<| (_.context "Exponentials and logarithms")
- (do {! r.monad}
- [sample (|> r.safe_frac (\ ! map (f.* +10.0)))]
+ (do {! random.monad}
+ [sample (|> random.safe_frac (\ ! map (f.* +10.0)))]
(_.test "Logarithm is the inverse of exponential."
(|> sample /.exp /.log (within? +0.000000000000001 sample)))))
(<| (_.context "Greatest-Common-Divisor and Least-Common-Multiple")
- (do {! r.monad}
- [#let [gen_nat (|> r.nat (\ ! map (|>> (n.% 1000) (n.max 1))))]
+ (do {! random.monad}
+ [#let [gen_nat (|> random.nat (\ ! map (|>> (n.% 1000) (n.max 1))))]
x gen_nat
y gen_nat]
($_ _.and
@@ -90,7 +92,9 @@
)))
/infix.test
+ /modulus.test
/modular.test
+ /number.test
/logic/continuous.test
/logic/fuzzy.test
)))