diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/macro/code.lux | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index bf6fb83a6..bf3d3f79a 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -45,18 +45,18 @@ (Random Code) (random.rec (function (_ random) - ($_ random.either - (random#each /.bit random.bit) - (random#each /.nat random.nat) - (random#each /.int random.int) - (random#each /.rev random.rev) - (random#each /.frac random.safe_frac) - (random#each /.text ..random_text) - (random#each /.symbol ..random_symbol) - (random#each /.form (..random_sequence random)) - (random#each /.variant (..random_sequence random)) - (random#each /.tuple (..random_sequence random)) - )))) + (all random.either + (random#each /.bit random.bit) + (random#each /.nat random.nat) + (random#each /.int random.int) + (random#each /.rev random.rev) + (random#each /.frac random.safe_frac) + (random#each /.text ..random_text) + (random#each /.symbol ..random_symbol) + (random#each /.form (..random_sequence random)) + (random#each /.variant (..random_sequence random)) + (random#each /.tuple (..random_sequence random)) + )))) (def: (read source_code) (-> Text (Try Code)) @@ -83,92 +83,92 @@ [parts (..random_sequence replacement_simulation)] (in [(to_code (list#each product.left parts)) (to_code (list#each product.right parts))])))))] - ($_ random.either - (random#in [original substitute]) - (do [! random.monad] - [sample (random.only (|>> (# /.equivalence = original) not) - ($_ random.either - (random#each /.bit random.bit) - (random#each /.nat random.nat) - (random#each /.int random.int) - (random#each /.rev random.rev) - (random#each /.frac random.safe_frac) - (random#each /.text ..random_text) - (random#each /.symbol ..random_symbol)))] - (in [sample sample])) - (for_sequence /.form) - (for_sequence /.variant) - (for_sequence /.tuple) - ))))) + (all random.either + (random#in [original substitute]) + (do [! random.monad] + [sample (random.only (|>> (# /.equivalence = original) not) + (all random.either + (random#each /.bit random.bit) + (random#each /.nat random.nat) + (random#each /.int random.int) + (random#each /.rev random.rev) + (random#each /.frac random.safe_frac) + (random#each /.text ..random_text) + (random#each /.symbol ..random_symbol)))] + (in [sample sample])) + (for_sequence /.form) + (for_sequence /.variant) + (for_sequence /.tuple) + ))))) (def: for_format Test - (`` ($_ _.and - (~~ (template [<coverage> <random> <tag>] - [(do [! random.monad] - [expected <random>] - (_.cover [<coverage>] - (and (case (..read (/.format (<coverage> expected))) - {try.#Success actual} - (# /.equivalence = - actual - (<coverage> expected)) - - {try.#Failure error} - false) - (# /.equivalence = - [location.dummy {<tag> expected}] - (<coverage> expected)))))] + (`` (all _.and + (~~ (template [<coverage> <random> <tag>] + [(do [! random.monad] + [expected <random>] + (_.cover [<coverage>] + (and (case (..read (/.format (<coverage> expected))) + {try.#Success actual} + (# /.equivalence = + actual + (<coverage> expected)) + + {try.#Failure error} + false) + (# /.equivalence = + [location.dummy {<tag> expected}] + (<coverage> expected)))))] - [/.bit random.bit .#Bit] - [/.nat random.nat .#Nat] - [/.int random.int .#Int] - [/.rev random.rev .#Rev] - [/.frac random.safe_frac .#Frac] - [/.text ..random_text .#Text] - [/.symbol ..random_symbol .#Symbol] - [/.form (..random_sequence ..random) .#Form] - [/.variant (..random_sequence ..random) .#Variant] - [/.tuple (..random_sequence ..random) .#Tuple])) - (~~ (template [<coverage> <random> <tag>] - [(do [! random.monad] - [expected <random>] - (_.cover [<coverage>] - (and (case (..read (/.format (<coverage> expected))) - {try.#Success actual} - (# /.equivalence = - actual - (<coverage> expected)) - - {try.#Failure error} - false) - (# /.equivalence = - [location.dummy {<tag> ["" expected]}] - (<coverage> expected))) - ))] + [/.bit random.bit .#Bit] + [/.nat random.nat .#Nat] + [/.int random.int .#Int] + [/.rev random.rev .#Rev] + [/.frac random.safe_frac .#Frac] + [/.text ..random_text .#Text] + [/.symbol ..random_symbol .#Symbol] + [/.form (..random_sequence ..random) .#Form] + [/.variant (..random_sequence ..random) .#Variant] + [/.tuple (..random_sequence ..random) .#Tuple])) + (~~ (template [<coverage> <random> <tag>] + [(do [! random.monad] + [expected <random>] + (_.cover [<coverage>] + (and (case (..read (/.format (<coverage> expected))) + {try.#Success actual} + (# /.equivalence = + actual + (<coverage> expected)) + + {try.#Failure error} + false) + (# /.equivalence = + [location.dummy {<tag> ["" expected]}] + (<coverage> expected))) + ))] - [/.local ..random_text .#Symbol] - ))))) + [/.local ..random_text .#Symbol] + ))))) (def: .public test Test (<| (_.covering /._) - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (_.for [/.format] - ..for_format) - - (do [! random.monad] - [[original substitute] (random.only (function (_ [original substitute]) - (not (# /.equivalence = original substitute))) - (random.and ..random ..random)) - [sample expected] (random.only (function (_ [sample expected]) - (not (# /.equivalence = sample expected))) - (..replacement_simulation [original substitute]))] - (_.cover [/.replaced] - (# /.equivalence = - expected - (/.replaced original substitute sample)))) - ))) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (_.for [/.format] + ..for_format) + + (do [! random.monad] + [[original substitute] (random.only (function (_ [original substitute]) + (not (# /.equivalence = original substitute))) + (random.and ..random ..random)) + [sample expected] (random.only (function (_ [sample expected]) + (not (# /.equivalence = sample expected))) + (..replacement_simulation [original substitute]))] + (_.cover [/.replaced] + (# /.equivalence = + expected + (/.replaced original substitute sample)))) + ))) |