aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/meta')
-rw-r--r--stdlib/source/test/lux/meta/compiler.lux9
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux.lux128
-rw-r--r--stdlib/source/test/lux/meta/configuration.lux7
-rw-r--r--stdlib/source/test/lux/meta/symbol.lux12
-rw-r--r--stdlib/source/test/lux/meta/type/unit.lux7
5 files changed, 151 insertions, 12 deletions
diff --git a/stdlib/source/test/lux/meta/compiler.lux b/stdlib/source/test/lux/meta/compiler.lux
index 6e56ccfac..a6589b9d5 100644
--- a/stdlib/source/test/lux/meta/compiler.lux
+++ b/stdlib/source/test/lux/meta/compiler.lux
@@ -8,7 +8,11 @@
[test
["_" property (.only Test)]]]]
[\\library
- ["[0]" /]])
+ ["[0]" /]]
+ ["[0]" /
+ ["[1][0]" arity]
+ ["[1][0]" language
+ ["[1]/[0]" lux]]])
(def .public test
Test
@@ -18,4 +22,7 @@
(all _.and
(_.coverage [/.Code /.Parameter /.Input]
true)
+
+ /arity.test
+ /language/lux.test
)))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux.lux
new file mode 100644
index 000000000..ed26027df
--- /dev/null
+++ b/stdlib/source/test/lux/meta/compiler/language/lux.lux
@@ -0,0 +1,128 @@
+(.require
+ [library
+ [lux (.except global)
+ [abstract
+ [equivalence (.only Equivalence)]
+ [monad (.only do)]]
+ [control
+ ["[0]" try (.use "[1]#[0]" functor)]]
+ [data
+ ["[0]" sum]
+ ["[0]" product]
+ ["[0]" bit]
+ ["[0]" text (.use "[1]#[0]" equivalence)]
+ ["[0]" binary
+ ["![1]" \\format]
+ ["?[1]" \\parser]]
+ [collection
+ ["[0]" list]]]
+ [math
+ ["[0]" random (.only Random) (.use "[1]#[0]" monad)]
+ [number
+ ["[0]" nat]]]
+ [meta
+ ["[0]" version]
+ ["[0]" type (.only)
+ ["[1]T" \\test]]
+ ["[0]" symbol (.only)
+ ["[1]T" \\test]]
+ [compiler
+ [meta
+ [archive
+ ["[0]" key]
+ ["[0]" signature]]]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def any_equivalence
+ (Equivalence Any)
+ (implementation
+ (def (= _ _)
+ true)))
+
+(def definition_equivalence
+ (Equivalence Definition)
+ (all product.equivalence
+ type.equivalence
+ ..any_equivalence
+ ))
+
+(def definition
+ (Random Definition)
+ (do random.monad
+ [type (typeT.random 1)]
+ (in [type []])))
+
+(def global_equivalence
+ (Equivalence Global)
+ (all sum.equivalence
+ ..definition_equivalence
+ symbol.equivalence
+ ..definition_equivalence
+ ))
+
+(def global
+ (Random Global)
+ (all random.or
+ ..definition
+ (symbolT.random 1 1)
+ ..definition
+ ))
+
+(def module_state_equivalence
+ (Equivalence Module_State)
+ (all sum.equivalence
+ ..any_equivalence
+ ..any_equivalence
+ ..any_equivalence
+ ))
+
+(def module_state
+ (Random Module_State)
+ (all random.or
+ (random#in [])
+ (random#in [])
+ (random#in [])
+ ))
+
+(def module_equivalence
+ (Equivalence Module)
+ (all product.equivalence
+ nat.equivalence
+ (list.equivalence (product.equivalence text.equivalence text.equivalence))
+ (list.equivalence (all product.equivalence text.equivalence bit.equivalence global_equivalence))
+ (list.equivalence text.equivalence)
+ ..module_state_equivalence
+ ))
+
+(def module
+ (Random Module)
+ (all random.and
+ random.nat
+ (random.list 1 (random.and (random.upper_cased 2) (random.upper_cased 3)))
+ (random.list 4 (all random.and (random.upper_cased 5) random.bit ..global))
+ (random.list 6 (random.upper_cased 7))
+ ..module_state
+ ))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [expected ..module])
+ (all _.and
+ (_.coverage [/.format /.parser]
+ (|> expected
+ (!binary.result /.format)
+ (?binary.result /.parser)
+ (try#each (of module_equivalence = (has .#module_state {.#Cached} expected)))
+ (try.else false)))
+ (_.coverage [/.key]
+ (let [it (key.signature /.key)]
+ (and (let [[expected_module _] (symbol /._)
+ [actual_module actual_short] (the signature.#name it)]
+ (and (text#= expected_module actual_module)))
+ (same? version.latest (the signature.#version it)))))
+ )))
diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux
index 24a6ecf76..b505f54d4 100644
--- a/stdlib/source/test/lux/meta/configuration.lux
+++ b/stdlib/source/test/lux/meta/configuration.lux
@@ -4,8 +4,9 @@
[abstract
[monad (.only do)]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" monoid]]]
+ ["$[0]" equivalence]]
+ ["[0]" monoid
+ ["[1]T" \\test]]]
[control
["<>" parser]
["[0]" try (.use "[1]#[0]" functor)]
@@ -58,7 +59,7 @@
(_.for [/.equivalence]
($equivalence.spec /.equivalence (..random 5)))
(_.for [/.monoid]
- ($monoid.spec /.equivalence /.monoid (..random 5)))
+ (monoidT.spec /.equivalence /.monoid (..random 5)))
(_.coverage [/.empty]
(list.empty? /.empty))
diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux
index d16275357..9751bc770 100644
--- a/stdlib/source/test/lux/meta/symbol.lux
+++ b/stdlib/source/test/lux/meta/symbol.lux
@@ -5,9 +5,11 @@
[monad (.only do)]
[\\specification
["$[0]" equivalence]
- ["$[0]" hash]
- ["$[0]" order]
- ["$[0]" codec]]]
+ ["$[0]" hash]]
+ ["[0]" codec
+ ["[1]T" \\test]]
+ ["[0]" order
+ ["[1]T" \\test]]]
[data
["[0]" text]]
[math
@@ -48,9 +50,9 @@
(of ! each (|>> [""]))
($hash.spec /.hash)))
(_.for [/.order]
- ($order.spec /.order (..random sizeM1 sizeS1)))
+ (orderT.spec /.order (..random sizeM1 sizeS1)))
(_.for [/.codec]
- (_.and ($codec.spec /.equivalence /.codec (..random sizeM1 sizeS1))
+ (_.and (codecT.spec /.equivalence /.codec (..random sizeM1 sizeS1))
(_.test "Encoding a symbol without a module component results in text equal to the short of the symbol."
(if (text.empty? module1)
(same? short1 (of /.codec encoded symbol1))
diff --git a/stdlib/source/test/lux/meta/type/unit.lux b/stdlib/source/test/lux/meta/type/unit.lux
index 6c27c1900..d13ba3680 100644
--- a/stdlib/source/test/lux/meta/type/unit.lux
+++ b/stdlib/source/test/lux/meta/type/unit.lux
@@ -6,8 +6,9 @@
[equivalence (.only Equivalence)]
[\\specification
["$[0]" equivalence]
- ["$[0]" order]
- ["$[0]" enum]]]
+ ["$[0]" enum]]
+ ["[0]" order
+ ["[1]T" \\test]]]
[data
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format]]]
@@ -43,7 +44,7 @@
(_.for [/.equivalence]
($equivalence.spec /.equivalence (..meter 1,000)))
(_.for [/.order]
- ($order.spec /.order (..meter 1,000)))
+ (orderT.spec /.order (..meter 1,000)))
(_.for [/.enum]
($enum.spec /.enum (..meter 1,000)))
))