aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-03-29 22:58:33 -0400
committerEduardo Julian2019-03-29 22:58:33 -0400
commit6bb6029f426ecb2da772f6f9c70cdb81c897f0db (patch)
tree0e33d20265838704b9c2be556f9c09c86e86b4da /stdlib/source/test/lux.lux
parenta869f51e0ea3fe0c224de1188ad5bbd5db080f47 (diff)
Fixed more tests.
Diffstat (limited to 'stdlib/source/test/lux.lux')
-rw-r--r--stdlib/source/test/lux.lux140
1 files changed, 67 insertions, 73 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 30abe1b37..a52c70fd4 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -9,7 +9,7 @@
[common (#+)]
[host (#+)]])]
(.module:
- [lux #*
+ ["/" lux #*
[cli (#+ program:)]
["." io (#+ io)]
[control
@@ -19,8 +19,7 @@
[number
["." i64]]]
["." function]
- ["." math
- ["r" random (#+ Random) ("#@." functor)]]
+ ["." math]
["_" test (#+ Test)]
## These modules do not need to be tested.
[type
@@ -28,11 +27,8 @@
[locale (#+)
[language (#+)]
[territory (#+)]]
- [data
- [text
- [format (#+)]]]
- ## [math
- ## [random (#+)]]
+ data/text/format
+ ["r" math/random (#+ Random) ("#@." functor)]
## TODO: Test these modules
[data
[format
@@ -235,8 +231,8 @@
(def: frac-rev
(r.Random Rev)
- (|> r.rev
- (:: r.functor map (|>> (i64.left-shift 11) (i64.logic-right-shift 11)))))
+ (let [bits-to-ignore 11]
+ (:: r.functor map (i64.left-shift bits-to-ignore) r.rev)))
(def: prelude-macros
Test
@@ -314,73 +310,71 @@
on-default))))))
(def: test
- ($_ _.and
- (<| (_.context "Identity.")
- ..identity)
- (<| (_.context "Increment & decrement.")
- ..increment-and-decrement)
- (<| (_.context "Even or odd.")
- ($_ _.and
- (<| (_.context "Natural numbers.")
- (..even-or-odd r.nat n/even? n/odd?))
- (<| (_.context "Integers.")
- (..even-or-odd r.int i/even? i/odd?))))
- (<| (_.context "Minimum and maximum.")
- (`` ($_ _.and
- (~~ (do-template [<=> <lt> <min> <gt> <max> <gen> <context>]
- [(<| (_.context <context>)
- (..minimum-and-maximum <gen> <=> [<lt> <min>] [<gt> <max>]))]
+ (<| (_.context (%name (name-of /._)))
+ ($_ _.and
+ (<| (_.context "Identity.")
+ ..identity)
+ (<| (_.context "Increment & decrement.")
+ ..increment-and-decrement)
+ (<| (_.context "Even or odd.")
+ ($_ _.and
+ (<| (_.context "Natural numbers.")
+ (..even-or-odd r.nat n/even? n/odd?))
+ (<| (_.context "Integers.")
+ (..even-or-odd r.int i/even? i/odd?))))
+ (<| (_.context "Minimum and maximum.")
+ (`` ($_ _.and
+ (~~ (do-template [<=> <lt> <min> <gt> <max> <gen> <context>]
+ [(<| (_.context <context>)
+ (..minimum-and-maximum <gen> <=> [<lt> <min>] [<gt> <max>]))]
- [i/= i/< i/min i/> i/max r.int "Integers."]
- [n/= n/< n/min n/> n/max r.nat "Natural numbers."]
- [r/= r/< r/min r/> r/max r.rev "Revolutions."]
- [f/= f/< f/min f/> f/max r.frac "Fractions."]
- )))))
- (<| (_.context "Conversion.")
- (`` ($_ _.and
- (~~ (do-template [<context> <=> <forward> <backward> <gen>]
- [(<| (_.context <context>)
- (..conversion <gen> <forward> <backward> <=>))]
+ [i/= i/< i/min i/> i/max r.int "Integers."]
+ [n/= n/< n/min n/> n/max r.nat "Natural numbers."]
+ [r/= r/< r/min r/> r/max r.rev "Revolutions."]
+ [f/= f/< f/min f/> f/max r.frac "Fractions."]
+ )))))
+ (<| (_.context "Conversion.")
+ (`` ($_ _.and
+ (~~ (do-template [<=> <forward> <backward> <gen>]
+ [(<| (_.context (format (%name (name-of <forward>))
+ " " (%name (name-of <backward>))))
+ (..conversion <gen> <forward> <backward> <=>))]
- ["Int -> Nat"
- i/= .nat .int (r@map (i/% +1,000,000) r.int)]
- ["Nat -> Int"
- n/= .int .nat (r@map (n/% 1,000,000) r.nat)]
- ["Int -> Frac"
- i/= int-to-frac frac-to-int (r@map (i/% +1,000,000) r.int)]
- ["Frac -> Int"
- f/= frac-to-int int-to-frac (r@map math.floor r.frac)]
- ["Rev -> Frac"
- r/= rev-to-frac frac-to-rev frac-rev]
- )))))
- (<| (_.context "Prelude macros.")
- ..prelude-macros)
- (<| (_.context "Templates.")
- ..template)
- (<| (_.context "Cross-platform support.")
- ..cross-platform-support)
- /cli.test
- /io.test
- (<| (_.context "/control")
- /control.test)
- (<| (_.context "/data")
- /data.test)
- /macro.test
- (<| (_.context "/math")
- /math.test)
- (<| (_.context "/time")
- /time.test)
- /type.test
- /world.test
- (<| (_.context "/host Host-platform interoperation")
- ($_ _.and
- /host.test
- (<| (_.context "/jvm JVM (Java Virtual Machine)")
- /host/jvm.test)))
- ))
+ [i/= .nat .int (r@map (i/% +1,000,000) r.int)]
+ [n/= .int .nat (r@map (n/% 1,000,000) r.nat)]
+ [i/= .int-to-frac .frac-to-int (r@map (i/% +1,000,000) r.int)]
+ [f/= .frac-to-int .int-to-frac (r@map (|>> (i/% +1,000,000) .int-to-frac) r.int)]
+ [r/= .rev-to-frac .frac-to-rev frac-rev]
+ )))))
+ (<| (_.context "Prelude macros.")
+ ..prelude-macros)
+ (<| (_.context "Templates.")
+ ..template)
+ (<| (_.context "Cross-platform support.")
+ ..cross-platform-support)
+ /cli.test
+ /io.test
+ (<| (_.context "/control")
+ /control.test)
+ (<| (_.context "/data")
+ /data.test)
+ /macro.test
+ (<| (_.context "/math")
+ /math.test)
+ (<| (_.context "/time")
+ /time.test)
+ /type.test
+ /world.test
+ (<| (_.context "/host Host-platform interoperation")
+ ($_ _.and
+ /host.test
+ (<| (_.context "/jvm JVM (Java Virtual Machine)")
+ /host/jvm.test)))
+ )))
(program: args
(<| io
_.run!
- (_.times 100)
+ ## (_.times 100)
+ (_.seed 4035274984803317370)
..test))