diff options
Diffstat (limited to 'stdlib/source/test/lux/abstract/enum.lux')
-rw-r--r-- | stdlib/source/test/lux/abstract/enum.lux | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 916dc04d0..dcc6b0898 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -2,7 +2,9 @@ [library [lux (.except) [abstract - [monad (.only do)]] + [monad (.only do)] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" maybe (.use "[1]#[0]" functor)]] [data @@ -56,3 +58,25 @@ can_be_backwards? every_element_is_a_successor?))) ))))) + +(def .public (spec (open "/#[0]") random) + (All (_ of) + (-> (/.Enum of) (Random of) + Test)) + (do random.monad + [sample random] + (<| (_.for [/.Enum]) + (all _.and + (_.for [/.order] + (orderT.spec /#order random)) + + (_.coverage [/.succ /.pred] + (and (/#= (|> sample /#succ /#pred) + sample) + (/#= (|> sample /#pred /#succ) + sample) + (not (/#= (/#succ sample) + sample)) + (not (/#= (/#pred sample) + sample)))) + )))) |