aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/static.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/meta/static.lux')
-rw-r--r--stdlib/source/test/lux/meta/static.lux29
1 files changed, 29 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux
index a7169d6af..2b69d4cb6 100644
--- a/stdlib/source/test/lux/meta/static.lux
+++ b/stdlib/source/test/lux/meta/static.lux
@@ -2,6 +2,7 @@
[library
[lux (.except)
[data
+ ["[0]" bit (.use "[1]#[0]" equivalence)]
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format (.only format)]]
[collection
@@ -39,6 +40,7 @@
_
false)))]
+ [/.bit /.random_bit bit#= and .#Bit]
[/.nat /.random_nat n.= n.+ .#Nat]
[/.int /.random_int i.= i.+ .#Int]
[/.rev /.random_rev r.= r.+ .#Rev]
@@ -91,4 +93,31 @@
l/* (/.literals code.nat (list l/0 l/1 l/2))]
(n.= (all n.+ l/0 l/1 l/2)
(all n.+ l/*))))
+ (_.coverage [/.if]
+ (with_expansions [<?> (/.random_bit)
+ <then> (/.random_nat)
+ <else> (/.random_nat)]
+ (n.= (if <?> <then> <else>)
+ (/.if <?> <then> <else>))))
+ (_.coverage [/.cond]
+ (with_expansions [<?> (/.random_bit)
+ <then> (/.random_nat)
+ <else> (/.random_nat)
+ <never> (/.random_frac)]
+ (n.= (if <?> <then> <else>)
+ (/.cond <?> <then>
+ (not <?>) <else>
+ ... never
+ <never>))))
+ (_.coverage [/.when]
+ (with_expansions [<0> (/.random_nat)
+ <1> (/.random_nat)
+ <2> (/.random_nat)]
+ (and (n.= (all n.+ <0> <1>)
+ (`` (all n.+ <0> <1> (,, (/.when false <2>)))))
+ (n.= (all n.+ <0> <1> <2>)
+ (`` (all n.+ <0> <1> (,, (/.when true <2>))))))))
+ (_.coverage [/.seed]
+ (not (n.= (/.seed)
+ (/.seed))))
))))