diff options
author | Eduardo Julian | 2019-10-14 00:58:36 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-10-14 00:58:36 -0400 |
commit | 7d2607a34183662bb640644888fb52281a2d3ab4 (patch) | |
tree | b76cd067f80443232811e8dbcc5ba71f40ae5571 /stdlib/source/test | |
parent | 4f939136769d9a3f64088115e3b48f0e491c7c37 (diff) |
The new compiler can compile & run the stdlib's test suite.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux.lux | 104 | ||||
-rw-r--r-- | stdlib/source/test/lux/data.lux | 81 |
2 files changed, 110 insertions, 75 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) diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index 116a4c890..fa544ccd5 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -1,6 +1,10 @@ (.module: [lux #* - ["_" test (#+ Test)]] + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [math + ["." random ("#@." monad)]]] ["." / #_ ["#." binary] ["#." bit] @@ -29,20 +33,34 @@ ["#." xml]] ["#." collection]]) +## TODO: Get rid of this ASAP +(template: (!bundle body) + (: Test + (do random.monad + [_ (wrap [])] + body))) + (def: number Test - ($_ _.and - /i8.test - /i16.test - /i32.test - /i64.test - /nat.test - /int.test - /rev.test - /frac.test - /ratio.test - /complex.test - )) + ## TODO: Inline ASAP + (let [part0 ($_ _.and + /i8.test + /i16.test + /i32.test + /i64.test) + part1 ($_ _.and + /nat.test + /int.test + /rev.test) + part2 ($_ _.and + /frac.test + /ratio.test + /complex.test)] + ($_ _.and + (!bundle part0) + (!bundle part1) + (!bundle part2) + ))) (def: text ($_ _.and @@ -58,18 +76,25 @@ (def: #export test Test - ($_ _.and - /binary.test - /bit.test - /color.test - /identity.test - /lazy.test - /maybe.test - /name.test - /product.test - /sum.test - ..number - ..text - ..format - /collection.test - )) + ## TODO: Inline ASAP + (let [test0 ($_ _.and + /binary.test + /bit.test + /color.test + /identity.test) + test1 ($_ _.and + /lazy.test + /maybe.test + /name.test + /product.test) + test2 ($_ _.and + /sum.test + ..number + ..text + ..format + /collection.test)] + ($_ _.and + (!bundle test0) + (!bundle test1) + (!bundle test2) + ))) |