From 7d2607a34183662bb640644888fb52281a2d3ab4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 14 Oct 2019 00:58:36 -0400 Subject: The new compiler can compile & run the stdlib's test suite. --- stdlib/source/test/lux.lux | 104 +++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 47 deletions(-) (limited to 'stdlib/source/test/lux.lux') 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 [<=> ] - [(<| (_.context ) - (..minimum-and-maximum <=> [ ] [ ]))] + (!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 [<=> ] + [(<| (_.context ) + (..minimum-and-maximum <=> [ ] [ ]))] - [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 [<=> ] - [(<| (_.context (format (%.name (name-of )) - " " (%.name (name-of )))) - (..conversion <=>))] + [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 [<=> ] + [(<| (_.context (format (%.name (name-of )) + " " (%.name (name-of )))) + (..conversion <=>))] - [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) -- cgit v1.2.3