diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/aedifex/artifact.lux | 9 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/time/date.lux | 36 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/type.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/auto.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/build.lux | 10 | ||||
-rw-r--r-- | stdlib/source/test/lux.lux | 517 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/bit.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/ffi.old.lux | 7 | ||||
-rw-r--r-- | stdlib/source/test/lux/macro/code.lux | 101 |
9 files changed, 526 insertions, 166 deletions
diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index ce0af7e7f..9152a3d22 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -31,10 +31,11 @@ (def: #export random (Random /.Artifact) - ($_ random.and - (random.ascii/alpha 1) - (random.ascii/alpha 1) - (random.ascii/alpha 1))) + (let [size 4] + ($_ random.and + (random.ascii/lower size) + (random.ascii/lower size) + (random.ascii/lower size)))) (def: #export test Test diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index e68645b8a..35ae3a157 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -3,9 +3,12 @@ [lux #* ["_" test (#+ Test)] [abstract - [monad (#+ do)]] + [monad (#+ do)] + [\\specification + ["$." equivalence]]] [control ["." try ("#\." functor)] + ["." exception] [parser ["<.>" text]]] [math @@ -14,7 +17,7 @@ ["n" nat] ["i" int]]] [time - ["." date] + ["." date ("#\." equivalence)] ["." year]]]] [\\program ["." /]]) @@ -35,13 +38,32 @@ Test (<| (_.covering /._) (_.for [/.Date]) - ($_ _.and - (do random.monad - [expected ..random] + (do random.monad + [expected ..random + candidate random.date] + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + (_.cover [/.format /.parser] (|> expected /.format (<text>.run /.parser) (try\map (\ /.equivalence = expected)) - (try.default false)))) - ))) + (try.default false))) + (_.cover [/.value /.date] + (|> expected + /.value + /.date + (try\map (\ /.equivalence = expected)) + (try.default false))) + (_.cover [/.year_is_out_of_range] + (case (/.date candidate) + (#try.Success date) + (is? candidate (/.value date)) + + (#try.Failure error) + (exception.match? /.year_is_out_of_range error))) + (_.cover [/.epoch] + (date\= date.epoch (/.value /.epoch))) + )))) diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux index 8418febee..93a13e26a 100644 --- a/stdlib/source/test/aedifex/artifact/type.lux +++ b/stdlib/source/test/aedifex/artifact/type.lux @@ -33,9 +33,9 @@ (<| (_.covering /._) (_.for [/.Type] ($_ _.and - (_.cover [/.lux_library /.jvm_library + (_.cover [/.lux_library /.jvm_library /.js_library /.pom /.md5 /.sha-1] - (let [options (list /.lux_library /.jvm_library + (let [options (list /.lux_library /.jvm_library /.js_library /.pom /.md5 /.sha-1) uniques (set.from_list text.hash options)] (n.= (list.size options) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 8539ce672..a7ea2795b 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -93,6 +93,8 @@ dummy_path (\ ! map (|>> (format source /)) (random.ascii/alpha 5)) [compiler resolution] $build.resolution] ($_ _.and + (_.cover [/.delay] + (n.> 0 /.delay)) (wrap (do promise.monad [verdict (do ///action.monad [_ (\ fs make_directory source) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index a702d4c3d..1292c232f 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -158,8 +158,14 @@ (wrap (and (text\= /.start start) (text\= /.success end))))] (_.cover' [/.do! - /.lux_group /.jvm_compiler_name /.js_compiler_name - /.start /.success] + /.lux_group + /.jvm_compiler_name + /.js_compiler_name + /.python_compiler_name + /.lua_compiler_name + /.ruby_compiler_name + /.start + /.success] (try.default false verdict))))) (do ! [#let [console (@version.echo "")] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index f1af7f5a5..26924ef8e 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -8,6 +8,7 @@ [program (#+ program:)] ["_" test (#+ Test)] ["@" target] + ["." meta] [abstract [monad (#+ do)] [predicate (#+ Predicate)]] @@ -16,9 +17,11 @@ [concurrency ["." atom (#+ Atom)]]] [data - ["." name] - [text + ["." bit ("#\." equivalence)] + ["." text ("#\." equivalence) ["%" format (#+ format)]]] + [macro + ["." code ("#\." equivalence)]] ["." math ["." random (#+ Random) ("#\." functor)] [number @@ -72,52 +75,6 @@ (not (is? self other)))) ))) -(def: increment_and_decrement - Test - (do random.monad - [value random.i64] - ($_ _.and - (_.test "'inc' and 'dec' are opposites." - (and (|> value inc dec (n.= value)) - (|> value dec inc (n.= value)))) - (_.test "'inc' and 'dec' shift the number by 1." - (and (|> (inc value) (n.- value) (n.= 1)) - (|> value (n.- (dec value)) (n.= 1))))))) - -(def: (check_neighbors has_property? value) - (All [a] (-> (Predicate (I64 a)) (I64 a) Bit)) - (and (|> value inc has_property?) - (|> value dec has_property?))) - -(def: (even_or_odd rand_gen even? odd?) - (All [a] (-> (Random (I64 a)) (Predicate (I64 a)) (Predicate (I64 a)) Test)) - (do random.monad - [value rand_gen] - ($_ _.and - (_.test "Every number is either even or odd." - (if (even? value) - (not (odd? value)) - (odd? value))) - (_.test "Every odd/even number is surrounded by two of the other kind." - (if (even? value) - (check_neighbors odd? value) - (check_neighbors even? value)))))) - -(type: (Equivalence a) - (-> a a Bit)) - -(def: (conversion rand_gen forward backward =) - (All [a b] (-> (Random a) (-> a b) (-> b a) (Equivalence a) Test)) - (do random.monad - [value rand_gen] - (_.test "Can convert between types in a lossless way." - (|> value forward backward (= value))))) - -(def: frac_rev - (Random Rev) - (let [bits_to_ignore 11] - (\ random.functor map (i64.left_shift bits_to_ignore) random.rev))) - (def: prelude_macros Test ($_ _.and @@ -132,36 +89,6 @@ (if (n.< iterations counter) (recur (inc counter) (n.+ factor value)) value))))) - - (do random.monad - [first random.nat - second random.nat - third random.nat] - (_.test "Can create lists easily through macros." - (and (case (list first second third) - (#.Cons first' (#.Cons second' (#.Cons third' #.Nil))) - (and (n.= first first') - (n.= second second') - (n.= third third')) - - _ - false) - (case (list& first (list second third)) - (#.Cons first' (#.Cons second' (#.Cons third' #.Nil))) - (and (n.= first first') - (n.= second second') - (n.= third third')) - - _ - false) - (case (list& first second (list third)) - (#.Cons first' (#.Cons second' (#.Cons third' #.Nil))) - (and (n.= first first') - (n.= second second') - (n.= third third')) - - _ - false)))) )) (template: (quadrance cat0 cat1) @@ -198,18 +125,6 @@ @.php on_valid_host} on_default)))))) -(def: conversion_tests - Test - (`` ($_ _.and - (~~ (template [<=> <forward> <backward> <gen>] - [(<| (_.context (format (%.name (name_of <forward>)) - " " (%.name (name_of <backward>)))) - (..conversion <gen> <forward> <backward> <=>))] - - [i.= .nat .int (random\map (i.% +1,000,000) random.int)] - [n.= .int .nat (random\map (n.% 1,000,000) random.nat)] - ))))) - (def: sub_tests Test (with_expansions [## TODO: Update & expand tests for this @@ -240,28 +155,428 @@ <extension> ))))) +(def: for_bit + Test + (do random.monad + [expected random.nat + dummy random.nat] + (_.for [/.Bit /.if] + ($_ _.and + (_.cover [/.false] + (n.= expected + (/.if /.false + dummy + expected))) + (_.cover [/.true] + (n.= expected + (/.if /.true + expected + dummy))) + (_.cover [/.or] + (and (not (/.or /.false /.false)) + (/.or /.false /.true) + (/.or /.true /.false) + (/.or /.true /.true))) + (_.cover [/.and] + (and (not (/.and /.false /.false)) + (not (/.and /.false /.true)) + (not (/.and /.true /.false)) + (/.and /.true /.true))) + (_.cover [/.not] + (and (bit\= /.true (/.not /.false)) + (bit\= /.false (/.not /.true)))) + (_.cover [/.cond] + (and (n.= expected + (/.cond /.true + expected + + ## else + dummy)) + (n.= expected + (/.cond /.false + dummy + + ## else + expected)) + (n.= expected + (/.cond /.true + expected + + /.false + dummy + + ## else + dummy)) + (n.= expected + (/.cond /.false + dummy + + /.true + expected + + ## else + dummy)))) + )))) + +(def: for_try + Test + (do random.monad + [expected_error (random.ascii/lower 5) + expected random.nat] + ($_ _.and + (_.cover [/.try] + (case (/.try expected) + (#.Left _) + false + + (#.Right actual) + (n.= expected actual))) + (_.cover [/.undefined] + (case (/.try (/.undefined)) + (#.Left _) + true + + (#.Right _) + false)) + (_.cover [/.error!] + (case (/.try (/.error! expected_error)) + (#.Left actual_error) + (text.contains? expected_error actual_error) + + (#.Right _) + false)) + ))) + +(def: for_list + Test + (do random.monad + [e/0 random.nat + e/1 random.nat + e/2 random.nat + e/3 random.nat] + ($_ _.and + (_.cover [/.list] + (case (/.list e/0 e/1) + (^ (/.list a/0 a/1)) + (and (n.= e/0 a/0) + (n.= e/1 a/1)) + + _ + false)) + (_.cover [/.list&] + (case (/.list& e/0 e/1 (/.list e/2 e/3)) + (^ (/.list& a/0 a/1 (/.list a/2 a/3))) + (and (n.= e/0 a/0) + (n.= e/1 a/1) + (n.= e/2 a/2) + (n.= e/3 a/3)) + + _ + false)) + ))) + +(interface: (Returner a) + (: (-> Any a) + return)) + +(implementation: (global_returner value) + (All [a] (-> a (Returner a))) + + (def: (return _) + value)) + +(def: for_interface + Test + (do random.monad + [expected random.nat + #let [local_returner (: (Returner Nat) + (/.implementation + (def: (return _) + expected)))]] + (_.for [/.interface:] + ($_ _.and + (_.cover [/.implementation:] + (n.= expected (\ (global_returner expected) return []))) + (_.cover [/.implementation] + (n.= expected (\ local_returner return []))) + )))) + +(def: for_module + Test + ($_ _.and + (let [[module short] (/.name_of .example)] + (_.cover [/.name_of /.prelude_module] + (and (text\= /.prelude_module module) + (text\= short "example")))) + (let [[module short] (/.name_of ..example)] + (_.cover [/.module_separator] + (and (text.contains? /.module_separator module) + (not (text.contains? /.module_separator short))))) + )) + +(def: for_pipe + Test + (do random.monad + [start random.nat + factor random.nat + #let [expected (n.* factor (inc start))]] + ($_ _.and + (_.cover [/.|>] + (n.= expected + (/.|> start inc (n.* factor)))) + (_.cover [/.|>>] + (n.= expected + ((/.|>> inc (n.* factor)) start))) + (_.cover [/.<|] + (n.= expected + (/.<| (n.* factor) inc start))) + (_.cover [/.<<|] + (n.= expected + ((/.<<| (n.* factor) inc) start))) + ))) + +(def: example "YOLO") +(def: i8 8) + +(def: current_module + Text + (let [[module _] (name_of .._)] + module)) + +(def: for_code/' + Test + (do random.monad + [example_nat random.nat] + (_.cover [/.'] + (and (code\= (code.nat 0) (/.' 0)) + (code\= (code.int -1) (/.' -1)) + (code\= (code.rev .2) (/.' .2)) + (code\= (code.frac +3.4) (/.' +3.4)) + (code\= (code.text "5") (/.' "5")) + (code\= (code.identifier ["" "example"]) + (/.' example)) + (code\= (code.identifier [/.prelude_module "example"]) + (/.' .example)) + (code\= (code.identifier [..current_module "example"]) + (/.' ..example)) + (code\= (code.tag ["" "example"]) + (/.' #example)) + (code\= (code.tag [/.prelude_module "example"]) + (/.' #.example)) + (code\= (code.tag [..current_module "example"]) + (/.' #..example)) + (code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8))) + (/.' (6 +7 .8))) + (code\= (code.tuple (list (code.frac +9.0) + (code.text "9") + (code.identifier ["" "i8"]))) + (/.' [+9.0 "9" i8])) + (code\= (code.record (list [(code.identifier [/.prelude_module "i7"]) + (code.identifier [..current_module "i6"])])) + (/.' {.i7 ..i6})) + (not (code\= (code.nat example_nat) + (/.' (~ (code.nat example_nat))))) + )))) + +(def: for_code/` + Test + (do random.monad + [example_nat random.nat] + (_.cover [/.`] + (and (code\= (code.nat 0) (/.` 0)) + (code\= (code.int -1) (/.` -1)) + (code\= (code.rev .2) (/.` .2)) + (code\= (code.frac +3.4) (/.` +3.4)) + (code\= (code.text "5") (/.` "5")) + (code\= (code.identifier [..current_module "example"]) + (/.` example)) + (code\= (code.identifier [/.prelude_module "example"]) + (/.` .example)) + (code\= (code.identifier [..current_module "example"]) + (/.` ..example)) + (code\= (code.tag [..current_module "example"]) + (/.` #example)) + (code\= (code.tag [/.prelude_module "example"]) + (/.` #.example)) + (code\= (code.tag [..current_module "example"]) + (/.` #..example)) + (code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8))) + (/.` (6 +7 .8))) + (code\= (code.tuple (list (code.frac +9.0) + (code.text "9") + (code.identifier [..current_module "i8"]))) + (/.` [+9.0 "9" i8])) + (code\= (code.record (list [(code.identifier [/.prelude_module "i7"]) + (code.identifier [..current_module "i6"])])) + (/.` {.i7 ..i6})) + (code\= (code.nat example_nat) + (/.` (~ (code.nat example_nat)))))))) + +(def: for_code/`' + Test + (do random.monad + [example_nat random.nat] + (_.cover [/.`'] + (and (code\= (code.nat 0) (/.`' 0)) + (code\= (code.int -1) (/.`' -1)) + (code\= (code.rev .2) (/.`' .2)) + (code\= (code.frac +3.4) (/.`' +3.4)) + (code\= (code.text "5") (/.`' "5")) + (code\= (code.identifier ["" "example"]) + (/.`' example)) + (code\= (code.identifier [/.prelude_module "example"]) + (/.`' .example)) + (code\= (code.identifier [..current_module "example"]) + (/.`' ..example)) + (code\= (code.tag ["" "example"]) + (/.`' #example)) + (code\= (code.tag [/.prelude_module "example"]) + (/.`' #.example)) + (code\= (code.tag [..current_module "example"]) + (/.`' #..example)) + (code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8))) + (/.`' (6 +7 .8))) + (code\= (code.tuple (list (code.frac +9.0) + (code.text "9") + (code.identifier ["" "i8"]))) + (/.`' [+9.0 "9" i8])) + (code\= (code.record (list [(code.identifier [/.prelude_module "i7"]) + (code.identifier [..current_module "i6"])])) + (/.`' {.i7 ..i6})) + (code\= (code.nat example_nat) + (/.`' (~ (code.nat example_nat)))))))) + +(def: for_code + Test + (do random.monad + [example_nat random.nat] + (_.for [/.Code /.Code'] + ($_ _.and + ..for_code/' + ..for_code/` + ..for_code/`' + )))) + +(/.macro: (identity_macro tokens) + (\ meta.monad wrap tokens)) + +(def: for_macro + Test + (let [macro (: /.Macro' + (function (_ tokens lux) + (#.Right [lux (list)])))] + (do random.monad + [expected random.nat] + ($_ _.and + (_.cover [/.Macro'] + (|> macro + (: /.Macro') + (is? macro))) + (_.cover [/.Macro] + (|> macro + "lux macro" + (: /.Macro) + (: Any) + (is? (: Any macro)))) + (_.cover [/.macro:] + (is? expected (..identity_macro expected))) + )))) + +(def: for_type + Test + (do random.monad + [expected random.nat + + expected_left random.nat + expected_right random.nat] + ($_ _.and + (_.cover [/.:] + (|> expected + (/.: Any) + (is? (/.: Any expected)))) + (_.cover [/.:as] + (|> expected + (/.: Any) + (/.:as /.Nat) + (is? expected))) + (_.cover [/.:assume] + (|> expected + (/.: Any) + /.:assume + (/.: /.Nat) + (is? expected))) + (_.cover [/.:let] + (let [[actual_left actual_right] + (: (/.:let [side /.Nat] + (& side side)) + [expected_left expected_right])] + (and (is? expected_left actual_left) + (is? expected_right actual_right)))) + (_.cover [/.:of] + (is? /.Nat (/.:of expected))) + ))) + +(def: for_i64 + Test + (do random.monad + [expected random.i64] + ($_ _.and + (_.cover [/.i64] + (is? (: Any expected) + (: Any (/.i64 expected)))) + (_.cover [/.nat] + (is? (: Any expected) + (: Any (/.nat expected)))) + (_.cover [/.int] + (is? (: Any expected) + (: Any (/.int expected)))) + (_.cover [/.rev] + (is? (: Any expected) + (: Any (/.rev expected)))) + (_.cover [/.inc] + (n.= 1 (n.- expected + (/.inc expected)))) + (_.cover [/.dec] + (n.= 1 (n.- (/.dec expected) + expected))) + ))) + +(def: for_function + Test + (do random.monad + [expected_left random.nat + expected_right random.nat] + (_.cover [/.-> /.function] + (let [actual (: (/.-> Nat Nat Nat) + (/.function (_ actual_left actual_right) + (n.* (inc actual_left) (dec actual_right))))] + (n.= (n.* (inc expected_left) (dec expected_right)) + (actual expected_left expected_right)))))) + (def: test Test - (<| (_.context (name.module (name_of /._))) + (<| (_.covering /._) ($_ _.and (<| (_.context "Identity.") ..identity) - (<| (_.context "Increment & decrement.") - ..increment_and_decrement) - (<| (_.context "Even or odd.") - ($_ _.and - (<| (_.context "Natural numbers.") - (..even_or_odd random.nat n.even? n.odd?)) - (<| (_.context "Integers.") - (..even_or_odd random.int i.even? i.odd?)))) - (<| (_.context "Conversion.") - ..conversion_tests) (<| (_.context "Prelude macros.") ..prelude_macros) (<| (_.context "Templates.") ..templates) (<| (_.context "Cross-platform support.") ..cross_platform_support) + + ..for_bit + ..for_try + ..for_list + ..for_interface + ..for_module + ..for_pipe + ..for_code + ..for_macro + ..for_type + ..for_i64 + ..for_function ..sub_tests ))) diff --git a/stdlib/source/test/lux/data/bit.lux b/stdlib/source/test/lux/data/bit.lux index fda210668..bffa5b808 100644 --- a/stdlib/source/test/lux/data/bit.lux +++ b/stdlib/source/test/lux/data/bit.lux @@ -33,6 +33,12 @@ (_.for [/.codec] ($codec.spec /.equivalence /.codec random.bit)) + (_.cover [/.no /.yes] + (and (\ /.equivalence = false /.no) + (\ /.equivalence = true /.yes))) + (_.cover [/.off /.on] + (and (\ /.equivalence = false /.off) + (\ /.equivalence = true /.on))) (_.cover [/.complement] (and (not (\ /.equivalence = value ((/.complement function.identity) value))) (\ /.equivalence = value ((/.complement not) value)))) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index 36ec40e21..aa4b73548 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -91,8 +91,11 @@ [long random.int int (\ ! map (|>> /.long_to_int) random.int) char (\ ! map (|>> /.long_to_int /.int_to_char) random.int) - double random.frac - float (\ ! map (|>> /.double_to_float) random.frac)] + double (|> random.frac + (random.filter (|>> f.not_a_number? not))) + float (|> random.frac + (random.filter (|>> f.not_a_number? not)) + (\ ! map (|>> /.double_to_float)))] (`` ($_ _.and (~~ (template [<=> <sample> <to> <from>] [(_.cover [<to> <from>] diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 8a037cc08..f0764fda7 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -113,6 +113,57 @@ (list.zip/2 parts' parts')))])) ))))) +(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)))))] + + [/.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] + [/.tag ..random_name #.Tag] + [/.identifier ..random_name #.Identifier] + [/.form (..random_sequence ..random) #.Form] + [/.tuple (..random_sequence ..random) #.Tuple] + [/.record (..random_record ..random) #.Record])) + (~~ (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_tag ..random_text #.Tag] + [/.local_identifier ..random_text #.Identifier] + ))))) + (def: #export test Test (<| (_.covering /._) @@ -121,54 +172,8 @@ ($equivalence.spec /.equivalence ..random)) (_.for [/.format] - (`` ($_ _.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] - [/.tag ..random_name #.Tag] - [/.identifier ..random_name #.Identifier] - [/.form (..random_sequence ..random) #.Form] - [/.tuple (..random_sequence ..random) #.Tuple] - [/.record (..random_record ..random) #.Record])) - (~~ (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_tag ..random_text #.Tag] - [/.local_identifier ..random_text #.Identifier] - ))))) + ..for_format) + (do {! random.monad} [[original substitute] (random.filter (function (_ [original substitute]) (not (\ /.equivalence = original substitute))) |