diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/macro/syntax/common/annotations.lux | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/macro/syntax/common/annotations.lux b/stdlib/source/test/lux/macro/syntax/common/annotations.lux new file mode 100644 index 000000000..bc29a00f6 --- /dev/null +++ b/stdlib/source/test/lux/macro/syntax/common/annotations.lux @@ -0,0 +1,52 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)] + {[0 #spec] + [/ + ["$." equivalence]]}] + [control + ["." try] + [parser + ["<.>" code]]] + [data + [collection + ["." list]]] + [math + ["." random (#+ Random)] + [number + ["n" nat]]]] + {1 + ["." /]} + ["$." //// #_ + ["#." code]]) + +(def: #export random + (Random /.Annotations) + (let [word (random.ascii/alpha 10) + tag (random.and word word)] + (do {! random.monad} + [size (\ ! map (n.% 10) random.nat)] + (random.list size (random.and tag $////code.random))))) + +(def: #export test + Test + (<| (_.covering /._) + (_.for [/.Annotations]) + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (_.cover [/.empty] + (list.empty? /.empty)) + (do random.monad + [expected ..random] + (_.cover [/.write /.parser] + (case (<code>.run /.parser + (list (/.write expected))) + (#try.Failure _) + false + + (#try.Success actual) + (\ /.equivalence = expected actual))))))) |