diff options
Diffstat (limited to 'stdlib/source/test/lux/meta/static.lux')
-rw-r--r-- | stdlib/source/test/lux/meta/static.lux | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux new file mode 100644 index 000000000..aa67ab7a2 --- /dev/null +++ b/stdlib/source/test/lux/meta/static.lux @@ -0,0 +1,93 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [data + ["[0]" text (.use "[1]#[0]" equivalence) + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" mix)]]] + [math + ["[0]" random (.use "[1]#[0]" functor)] + [number + ["n" nat] + ["i" int] + ["r" rev] + ["f" frac]]] + ["[0]" meta (.only) + ["@" target] + ["[0]" code]]]] + [\\library + ["[0]" /]]) + +(def .public test + Test + (<| (_.covering /._) + (for @.old (_.property "PLACEHOLDER" true)) + (_.for [meta.eval]) + (`` (all _.and + (,, (with_template [<static> <random> <=> <+> <tag>] + [(_.coverage [<static> <random>] + (with_expansions [<left> (<random>) + <right> (<random>) + <l+r> (<static> (<+> <left> <right>))] + (case (' <l+r>) + [_ {<tag> l+r}] + (<=> l+r (<+> <left> <right>)) + + _ + false)))] + + [/.nat /.random_nat n.= n.+ .#Nat] + [/.int /.random_int i.= i.+ .#Int] + [/.rev /.random_rev r.= r.+ .#Rev] + )) + (_.coverage [/.frac /.random_frac] + (with_expansions [<left> (/.random_frac) + <right> (/.random_frac) + <l+r> (/.frac (f.+ <left> <right>))] + (case (' <l+r>) + [_ {.#Frac l+r}] + (or (f.= l+r (f.+ <left> <right>)) + (and (f.not_a_number? l+r) + (f.not_a_number? (f.+ <left> <right>)) + (or (f.not_a_number? <left>) + (f.not_a_number? <right>)))) + + _ + false))) + (_.coverage [/.text /.random] + (with_expansions [<left> (/.random code.text (random.alpha_numeric 1)) + <right> (/.random code.text (random.alpha_numeric 1)) + <l+r> (/.text (format <left> <right>))] + (case (' <l+r>) + [_ {.#Text l+r}] + (text#= l+r (format <left> <right>)) + + _ + false))) + (_.coverage [/.randoms] + (with_expansions [<amount> (/.random code.nat + (random#each (|>> (n.% 10) ++) random.nat)) + l/* (/.randoms code.nat (random.list <amount> random.nat))] + (and (n.= <amount> (list.size (list l/*))) + (n.= (list#mix n.+ 0 (list l/*)) + (all n.+ l/*))))) + (_.coverage [/.literal] + (with_expansions [<left> (/.random code.text (random.alpha_numeric 1)) + <right> (/.random code.text (random.alpha_numeric 1)) + <l+r> (/.literal code.text (format <left> <right>))] + (case (' <l+r>) + [_ {.#Text l+r}] + (text#= l+r (format <left> <right>)) + + _ + false))) + (_.coverage [/.literals] + (with_expansions [l/0 (/.random_nat) + l/1 (/.random_nat) + l/2 (/.random_nat) + l/* (/.literals code.nat (list l/0 l/1 l/2))] + (n.= (all n.+ l/0 l/1 l/2) + (all n.+ l/*)))) + )))) |