aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-10-14 00:58:36 -0400
committerEduardo Julian2019-10-14 00:58:36 -0400
commit7d2607a34183662bb640644888fb52281a2d3ab4 (patch)
treeb76cd067f80443232811e8dbcc5ba71f40ae5571 /stdlib/source/test/lux.lux
parent4f939136769d9a3f64088115e3b48f0e491c7c37 (diff)
The new compiler can compile & run the stdlib's test suite.
Diffstat (limited to 'stdlib/source/test/lux.lux')
-rw-r--r--stdlib/source/test/lux.lux104
1 files changed, 57 insertions, 47 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 22208adcc..d9fbc7b1d 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -140,6 +140,13 @@
["#/." jvm]]]
))
+## TODO: Get rid of this ASAP
+(template: (!bundle body)
+ (: Test
+ (do random.monad
+ [_ (wrap [])]
+ body)))
+
(def: identity
Test
(do random.monad
@@ -309,55 +316,58 @@
(def: test
(<| (_.context (name.module (name-of /._)))
($_ _.and
- (<| (_.context "Identity.")
- ..identity)
- (<| (_.context "Increment & decrement.")
- ..increment-and-decrement)
- (<| (_.context "Even or odd.")
- ($_ _.and
- (<| (_.context "Natural numbers.")
- (..even-or-odd random.nat n.even? n.odd?))
- (<| (_.context "Integers.")
- (..even-or-odd random.int i.even? i.odd?))))
- (<| (_.context "Minimum and maximum.")
- (`` ($_ _.and
- (~~ (template [<=> <lt> <min> <gt> <max> <gen> <context>]
- [(<| (_.context <context>)
- (..minimum-and-maximum <gen> <=> [<lt> <min>] [<gt> <max>]))]
+ (!bundle ($_ _.and
+ (<| (_.context "Identity.")
+ ..identity)
+ (<| (_.context "Increment & decrement.")
+ ..increment-and-decrement)
+ (<| (_.context "Even or odd.")
+ ($_ _.and
+ (<| (_.context "Natural numbers.")
+ (..even-or-odd random.nat n.even? n.odd?))
+ (<| (_.context "Integers.")
+ (..even-or-odd random.int i.even? i.odd?))))
+ (<| (_.context "Minimum and maximum.")
+ (`` ($_ _.and
+ (~~ (template [<=> <lt> <min> <gt> <max> <gen> <context>]
+ [(<| (_.context <context>)
+ (..minimum-and-maximum <gen> <=> [<lt> <min>] [<gt> <max>]))]
- [i.= i.< i.min i.> i.max random.int "Integers."]
- [n.= n.< n.min n.> n.max random.nat "Natural numbers."]
- [r.= r.< r.min r.> r.max random.rev "Revolutions."]
- [f.= f.< f.min f.> f.max random.safe-frac "Fractions."]
- )))))
- (<| (_.context "Conversion.")
- (`` ($_ _.and
- (~~ (template [<=> <forward> <backward> <gen>]
- [(<| (_.context (format (%.name (name-of <forward>))
- " " (%.name (name-of <backward>))))
- (..conversion <gen> <forward> <backward> <=>))]
+ [i.= i.< i.min i.> i.max random.int "Integers."]
+ [n.= n.< n.min n.> n.max random.nat "Natural numbers."]
+ [r.= r.< r.min r.> r.max random.rev "Revolutions."]
+ [f.= f.< f.min f.> f.max random.safe-frac "Fractions."]
+ )))))
+ (<| (_.context "Conversion.")
+ (`` ($_ _.and
+ (~~ (template [<=> <forward> <backward> <gen>]
+ [(<| (_.context (format (%.name (name-of <forward>))
+ " " (%.name (name-of <backward>))))
+ (..conversion <gen> <forward> <backward> <=>))]
- [i.= .nat .int (random@map (i.% +1,000,000) random.int)]
- [n.= .int .nat (random@map (n.% 1,000,000) random.nat)]
- [i.= i.frac f.int (random@map (i.% +1,000,000) random.int)]
- [f.= f.int i.frac (random@map (|>> (i.% +1,000,000) i.frac) random.int)]
- [r.= r.frac f.rev frac-rev]
- )))))
- (<| (_.context "Prelude macros.")
- ..prelude-macros)
- (<| (_.context "Templates.")
- ..templates)
- (<| (_.context "Cross-platform support.")
- ..cross-platform-support)
- /abstract.test
- /control.test
- /data.test
- /macro.test
- /math.test
- /time.test
- /tool.test
- /type.test
- /world.test
+ [i.= .nat .int (random@map (i.% +1,000,000) random.int)]
+ [n.= .int .nat (random@map (n.% 1,000,000) random.nat)]
+ [i.= i.frac f.int (random@map (i.% +1,000,000) random.int)]
+ [f.= f.int i.frac (random@map (|>> (i.% +1,000,000) i.frac) random.int)]
+ [r.= r.frac f.rev frac-rev]
+ )))))
+ (<| (_.context "Prelude macros.")
+ ..prelude-macros)
+ (<| (_.context "Templates.")
+ ..templates)
+ (<| (_.context "Cross-platform support.")
+ ..cross-platform-support)))
+ (!bundle ($_ _.and
+ /abstract.test
+ /control.test
+ /data.test
+ /macro.test
+ /math.test))
+ (!bundle ($_ _.and
+ /time.test
+ /tool.test
+ /type.test
+ /world.test))
/host.test
($_ _.and
/target/jvm.test)