aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/macro/syntax/check.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/meta/macro/syntax/check.lux')
-rw-r--r--stdlib/source/test/lux/meta/macro/syntax/check.lux48
1 files changed, 48 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/meta/macro/syntax/check.lux b/stdlib/source/test/lux/meta/macro/syntax/check.lux
new file mode 100644
index 000000000..1820536b8
--- /dev/null
+++ b/stdlib/source/test/lux/meta/macro/syntax/check.lux
@@ -0,0 +1,48 @@
+(.require
+ [library
+ [lux (.except)
+ ["_" test (.only Test)]
+ [abstract
+ [monad (.only do)]
+ [\\specification
+ ["$[0]" equivalence]]]
+ [control
+ ["<>" parser]
+ ["[0]" try]]
+ [math
+ ["[0]" random (.only Random)]]
+ [meta
+ ["[0]" code (.use "[1]#[0]" equivalence)
+ ["<[1]>" \\parser]]]]]
+ [\\library
+ ["[0]" /]]
+ ["$[0]" ////
+ ["[1][0]" code]])
+
+(def .public random
+ (Random /.Check)
+ (all random.and
+ $////code.random
+ $////code.random
+ ))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Check])
+ (all _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
+ (do random.monad
+ [[type value] ..random]
+ (_.coverage [/.format /.parser]
+ (case (<code>.result /.parser
+ (list (/.format [/.#type type
+ /.#value value])))
+ {try.#Failure _}
+ false
+
+ {try.#Success check}
+ (and (code#= type (the /.#type check))
+ (code#= value (the /.#value check)))))))))