diff options
Diffstat (limited to 'stdlib/source/test/lux/control/parser')
-rw-r--r-- | stdlib/source/test/lux/control/parser/analysis.lux | 130 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/binary.lux | 276 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/cli.lux | 80 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/code.lux | 114 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/environment.lux | 38 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/json.lux | 144 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/synthesis.lux | 160 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/text.lux | 350 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/tree.lux | 54 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/type.lux | 402 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/xml.lux | 94 |
11 files changed, 921 insertions, 921 deletions
diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux index 365696b14..92be5bc35 100644 --- a/stdlib/source/test/lux/control/parser/analysis.lux +++ b/stdlib/source/test/lux/control/parser/analysis.lux @@ -55,33 +55,33 @@ (`` (all _.and (do [! random.monad] [expected (# ! each (|>> analysis.bit) random.bit)] - (_.cover [/.result /.any] - (|> (list expected) - (/.result /.any) - (pipe.case - {try.#Success actual} - (# analysis.equivalence = expected actual) + (_.coverage [/.result /.any] + (|> (list expected) + (/.result /.any) + (pipe.case + {try.#Success actual} + (# analysis.equivalence = expected actual) - {try.#Failure _} - false)))) + {try.#Failure _} + false)))) (~~ (template [<query> <check> <random> <analysis> <=>] [(do [! random.monad] [expected <random>] - (_.cover [<query>] - (|> (list (<analysis> expected)) - (/.result <query>) - (pipe.case - {try.#Success actual} - (<=> expected actual) + (_.coverage [<query>] + (|> (list (<analysis> expected)) + (/.result <query>) + (pipe.case + {try.#Success actual} + (<=> expected actual) - {try.#Failure _} - false)))) + {try.#Failure _} + false)))) (do [! random.monad] [expected <random>] - (_.cover [<check>] - (|> (list (<analysis> expected)) - (/.result (<check> expected)) - (!expect {try.#Success _}))))] + (_.coverage [<check>] + (|> (list (<analysis> expected)) + (/.result (<check> expected)) + (!expect {try.#Success _}))))] [/.bit /.this_bit random.bit analysis.bit bit#=] [/.nat /.this_nat random.nat analysis.nat n.=] @@ -95,61 +95,61 @@ )) (do [! random.monad] [expected random.bit] - (_.cover [/.tuple] - (|> (list (analysis.tuple (list (analysis.bit expected)))) - (/.result (/.tuple /.bit)) - (pipe.case - {try.#Success actual} - (bit#= expected actual) + (_.coverage [/.tuple] + (|> (list (analysis.tuple (list (analysis.bit expected)))) + (/.result (/.tuple /.bit)) + (pipe.case + {try.#Success actual} + (bit#= expected actual) - {try.#Failure _} - false)))) + {try.#Failure _} + false)))) (do [! random.monad] [dummy random.bit] - (_.cover [/.end?] - (and (|> (/.result /.end? (list)) - (!expect {try.#Success #1})) - (|> (/.result (do <>.monad - [verdict /.end? - _ /.bit] - (in verdict)) - (list (analysis.bit dummy))) - (!expect {try.#Success #0}))))) + (_.coverage [/.end?] + (and (|> (/.result /.end? (list)) + (!expect {try.#Success #1})) + (|> (/.result (do <>.monad + [verdict /.end? + _ /.bit] + (in verdict)) + (list (analysis.bit dummy))) + (!expect {try.#Success #0}))))) (do [! random.monad] [dummy random.bit] - (_.cover [/.end] - (and (|> (/.result /.end (list)) - (!expect {try.#Success _})) - (|> (/.result /.end (list (analysis.bit dummy))) - (!expect {try.#Failure _}))))) + (_.coverage [/.end] + (and (|> (/.result /.end (list)) + (!expect {try.#Success _})) + (|> (/.result /.end (list (analysis.bit dummy))) + (!expect {try.#Failure _}))))) (do [! random.monad] [expected random.bit] - (_.cover [/.cannot_parse] - (and (|> (list (analysis.bit expected)) - (/.result /.nat) - (pipe.case - {try.#Success _} - false + (_.coverage [/.cannot_parse] + (and (|> (list (analysis.bit expected)) + (/.result /.nat) + (pipe.case + {try.#Success _} + false - {try.#Failure error} - (exception.match? /.cannot_parse error))) - (|> (list) - (/.result /.bit) - (pipe.case - {try.#Success _} - false + {try.#Failure error} + (exception.match? /.cannot_parse error))) + (|> (list) + (/.result /.bit) + (pipe.case + {try.#Success _} + false - {try.#Failure error} - (exception.match? /.cannot_parse error)))))) + {try.#Failure error} + (exception.match? /.cannot_parse error)))))) (do [! random.monad] [expected random.bit] - (_.cover [/.unconsumed_input] - (|> (list (analysis.bit expected) (analysis.bit expected)) - (/.result /.bit) - (pipe.case - {try.#Success _} - false + (_.coverage [/.unconsumed_input] + (|> (list (analysis.bit expected) (analysis.bit expected)) + (/.result /.bit) + (pipe.case + {try.#Success _} + false - {try.#Failure error} - (exception.match? /.unconsumed_input error))))) + {try.#Failure error} + (exception.match? /.unconsumed_input error))))) ))))) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 2a7284c1d..50f1bea42 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -130,12 +130,12 @@ [(do [! random.monad] [expected (# ! each (i64.and (i64.mask <size>)) random.nat)] - (_.cover [<size> <parser> <format>] - (|> (format.result <format> expected) - (/.result <parser>) - (!expect (^.multi {try.#Success actual} - (n.= (.nat expected) - (.nat actual)))))))] + (_.coverage [<size> <parser> <format>] + (|> (format.result <format> expected) + (/.result <parser>) + (!expect (^.multi {try.#Success actual} + (n.= (.nat expected) + (.nat actual)))))))] [/.size_8 /.bits_8 format.bits_8] [/.size_16 /.bits_16 format.bits_16] @@ -149,11 +149,11 @@ (~~ (template [<parser> <format>] [(do [! random.monad] [expected (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] - (_.cover [<parser> <format>] - (|> (format.result <format> expected) - (/.result <parser>) - (!expect (^.multi {try.#Success actual} - (# binary.equivalence = expected actual))))))] + (_.coverage [<parser> <format>] + (|> (format.result <format> expected) + (/.result <parser>) + (!expect (^.multi {try.#Success actual} + (# binary.equivalence = expected actual))))))] [/.binary_8 format.binary_8] [/.binary_16 format.binary_16] @@ -167,11 +167,11 @@ (~~ (template [<parser> <format>] [(do [! random.monad] [expected (random.ascii ..segment_size)] - (_.cover [<parser> <format>] - (|> (format.result <format> expected) - (/.result <parser>) - (!expect (^.multi {try.#Success actual} - (# text.equivalence = expected actual))))))] + (_.coverage [<parser> <format>] + (|> (format.result <format> expected) + (/.result <parser>) + (!expect (^.multi {try.#Success actual} + (# text.equivalence = expected actual))))))] [/.utf8_8 format.utf8_8] [/.utf8_16 format.utf8_16] @@ -186,12 +186,12 @@ (~~ (template [<parser> <format>] [(do [! random.monad] [expected (random.sequence ..segment_size random.nat)] - (_.cover [<parser> <format>] - (|> expected - (format.result (<format> format.nat)) - (/.result (<parser> /.nat)) - (!expect (^.multi {try.#Success actual} - (# (sequence.equivalence n.equivalence) = expected actual))))))] + (_.coverage [<parser> <format>] + (|> expected + (format.result (<format> format.nat)) + (/.result (<parser> /.nat)) + (!expect (^.multi {try.#Success actual} + (# (sequence.equivalence n.equivalence) = expected actual))))))] [/.sequence_8 format.sequence_8] [/.sequence_16 format.sequence_16] @@ -205,12 +205,12 @@ (~~ (template [<parser> <format> <random> <equivalence>] [(do [! random.monad] [expected <random>] - (_.cover [<parser> <format>] - (|> expected - (format.result <format>) - (/.result <parser>) - (!expect (^.multi {try.#Success actual} - (# <equivalence> = expected actual))))))] + (_.coverage [<parser> <format>] + (|> expected + (format.result <format>) + (/.result <parser>) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))))] [/.bit format.bit random.bit bit.equivalence] [/.nat format.nat random.nat n.equivalence] @@ -218,24 +218,24 @@ [/.rev format.rev random.rev rev.equivalence])) (do [! random.monad] [expected random.frac] - (_.cover [/.frac format.frac] - (|> expected - (format.result format.frac) - (/.result /.frac) - (!expect (^.multi {try.#Success actual} - (or (# frac.equivalence = expected actual) - (and (frac.not_a_number? expected) - (frac.not_a_number? actual)))))))) + (_.coverage [/.frac format.frac] + (|> expected + (format.result format.frac) + (/.result /.frac) + (!expect (^.multi {try.#Success actual} + (or (# frac.equivalence = expected actual) + (and (frac.not_a_number? expected) + (frac.not_a_number? actual)))))))) (do [! random.monad] [expected (# ! each (|>> (i64.and (i64.mask /.size_8)) (n.max 2)) random.nat)] - (_.cover [/.not_a_bit] - (|> expected - (format.result format.bits_8) - (/.result /.bit) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_a_bit error)))))) + (_.coverage [/.not_a_bit] + (|> expected + (format.result format.bits_8) + (/.result /.bit) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_a_bit error)))))) ))) (def: complex @@ -244,12 +244,12 @@ (~~ (template [<parser> <format> <random> <equivalence>] [(do [! random.monad] [expected <random>] - (_.cover [<parser> <format>] - (|> expected - (format.result <format>) - (/.result <parser>) - (!expect (^.multi {try.#Success actual} - (# <equivalence> = expected actual))))))] + (_.coverage [<parser> <format>] + (|> expected + (format.result <format>) + (/.result <parser>) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))))] [/.location format.location random_location location_equivalence] [/.code format.code random_code code.equivalence] @@ -258,12 +258,12 @@ (~~ (template [<parser_coverage> <parser> <coverage_format> <format> <random> <equivalence>] [(do [! random.monad] [expected <random>] - (_.cover [<parser_coverage> <coverage_format>] - (|> expected - (format.result <format>) - (/.result <parser>) - (!expect (^.multi {try.#Success actual} - (# <equivalence> = expected actual))))))] + (_.coverage [<parser_coverage> <coverage_format>] + (|> expected + (format.result <format>) + (/.result <parser>) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))))] [/.maybe (/.maybe /.nat) format.maybe (format.maybe format.nat) (random.maybe random.nat) (maybe.equivalence n.equivalence)] [/.list (/.list /.nat) format.list (format.list format.nat) (random.list ..segment_size random.nat) (list.equivalence n.equivalence)] @@ -271,51 +271,51 @@ [/.symbol /.symbol format.symbol format.symbol ..random_symbol symbol.equivalence])) (do [! random.monad] [expected (# ! each (list.repeated ..segment_size) random.nat)] - (_.cover [/.set_elements_are_not_unique] - (|> expected - (format.result (format.list format.nat)) - (/.result (/.set n.hash /.nat)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.set_elements_are_not_unique error)))))) + (_.coverage [/.set_elements_are_not_unique] + (|> expected + (format.result (format.list format.nat)) + (/.result (/.set n.hash /.nat)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.set_elements_are_not_unique error)))))) (do [! random.monad] [expected (random.or random.bit random.nat)] - (_.cover [/.or format.or] - (|> expected - (format.result (format.or format.bit format.nat)) - (/.result (is (/.Parser (Either Bit Nat)) - (/.or /.bit /.nat))) - (!expect (^.multi {try.#Success actual} - (# (sum.equivalence bit.equivalence n.equivalence) = - expected - actual)))))) + (_.coverage [/.or format.or] + (|> expected + (format.result (format.or format.bit format.nat)) + (/.result (is (/.Parser (Either Bit Nat)) + (/.or /.bit /.nat))) + (!expect (^.multi {try.#Success actual} + (# (sum.equivalence bit.equivalence n.equivalence) = + expected + actual)))))) (do [! random.monad] [tag (# ! each (|>> (i64.and (i64.mask /.size_8)) (n.max 2)) random.nat) value random.bit] - (_.cover [/.invalid_tag] - (|> [tag value] - (format.result (format.and format.bits_8 format.bit)) - (/.result (is (/.Parser (Either Bit Nat)) - (/.or /.bit /.nat))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.invalid_tag error)))))) + (_.coverage [/.invalid_tag] + (|> [tag value] + (format.result (format.and format.bits_8 format.bit)) + (/.result (is (/.Parser (Either Bit Nat)) + (/.or /.bit /.nat))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.invalid_tag error)))))) (do [! random.monad] [expected (random.list ..segment_size random.nat)] - (_.cover [/.rec format.rec format.and format.any] - (|> expected - (format.result (format.rec (|>> (format.and format.nat) - (format.or format.any)))) - (/.result (is (/.Parser (List Nat)) - (/.rec - (function (_ again) - (/.or /.any - (<>.and /.nat - again)))))) - (!expect (^.multi {try.#Success actual} - (# (list.equivalence n.equivalence) = - expected - actual)))))) + (_.coverage [/.rec format.rec format.and format.any] + (|> expected + (format.result (format.rec (|>> (format.and format.nat) + (format.or format.any)))) + (/.result (is (/.Parser (List Nat)) + (/.rec + (function (_ again) + (/.or /.any + (<>.and /.nat + again)))))) + (!expect (^.multi {try.#Success actual} + (# (list.equivalence n.equivalence) = + expected + actual)))))) ))) (def: .public test @@ -323,66 +323,66 @@ (<| (_.covering /._) (_.for [/.Parser]) (`` (all _.and - (_.cover [/.result /.any - format.no_op format.instance] - (|> (format.instance format.no_op) - (/.result /.any) - (!expect {try.#Success _}))) + (_.coverage [/.result /.any + format.no_op format.instance] + (|> (format.instance format.no_op) + (/.result /.any) + (!expect {try.#Success _}))) (do [! random.monad] [data (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] - (_.cover [/.binary_was_not_fully_read] - (|> data - (/.result /.any) - (!expect (^.multi {try.#Failure error} - (exception.match? /.binary_was_not_fully_read error)))))) + (_.coverage [/.binary_was_not_fully_read] + (|> data + (/.result /.any) + (!expect (^.multi {try.#Failure error} + (exception.match? /.binary_was_not_fully_read error)))))) (do [! random.monad] [expected (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] - (_.cover [/.segment format.segment format.result] - (|> expected - (format.result (format.segment ..segment_size)) - (/.result (/.segment ..segment_size)) - (!expect (^.multi {try.#Success actual} - (# binary.equivalence = expected actual)))))) + (_.coverage [/.segment format.segment format.result] + (|> expected + (format.result (format.segment ..segment_size)) + (/.result (/.segment ..segment_size)) + (!expect (^.multi {try.#Success actual} + (# binary.equivalence = expected actual)))))) (do [! random.monad] [data (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] - (_.cover [/.end?] - (|> data - (/.result (do <>.monad - [pre /.end? - _ (/.segment ..segment_size) - post /.end?] - (in (and (not pre) - post)))) - (!expect {try.#Success #1})))) + (_.coverage [/.end?] + (|> data + (/.result (do <>.monad + [pre /.end? + _ (/.segment ..segment_size) + post /.end?] + (in (and (not pre) + post)))) + (!expect {try.#Success #1})))) (do [! random.monad] [to_read (# ! each (n.% (++ ..segment_size)) random.nat) data (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] - (_.cover [/.Offset /.offset] - (|> data - (/.result (do <>.monad - [start /.offset - _ (/.segment to_read) - offset /.offset - _ (/.segment (n.- to_read ..segment_size)) - nothing_left /.offset] - (in (and (n.= 0 start) - (n.= to_read offset) - (n.= ..segment_size nothing_left))))) - (!expect {try.#Success #1})))) + (_.coverage [/.Offset /.offset] + (|> data + (/.result (do <>.monad + [start /.offset + _ (/.segment to_read) + offset /.offset + _ (/.segment (n.- to_read ..segment_size)) + nothing_left /.offset] + (in (and (n.= 0 start) + (n.= to_read offset) + (n.= ..segment_size nothing_left))))) + (!expect {try.#Success #1})))) (do [! random.monad] [to_read (# ! each (n.% (++ ..segment_size)) random.nat) data (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] - (_.cover [/.remaining] - (|> data - (/.result (do <>.monad - [_ (/.segment to_read) - remaining /.remaining - _ (/.segment (n.- to_read ..segment_size)) - nothing_left /.remaining] - (in (and (n.= ..segment_size - (n.+ to_read remaining)) - (n.= 0 nothing_left))))) - (!expect {try.#Success #1})))) + (_.coverage [/.remaining] + (|> data + (/.result (do <>.monad + [_ (/.segment to_read) + remaining /.remaining + _ (/.segment (n.- to_read ..segment_size)) + nothing_left /.remaining] + (in (and (n.= ..segment_size + (n.+ to_read remaining)) + (n.= 0 nothing_left))))) + (!expect {try.#Success #1})))) ..size ..binary ..utf8 diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index 5dc368174..69d9a20e7 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -42,44 +42,44 @@ pre_ignore (random.list 5 random_dummy) post_ignore (random.list 5 random_dummy)] (all _.and - (_.cover [/.result /.any] - (|> (/.result /.any (list expected)) - (!expect (^.multi {try.#Success actual} - (text#= expected actual))))) - (_.cover [/.parse] - (|> (/.result (/.parse n#decoded) (list expected)) - (!expect (^.multi {try.#Success actual} - (text#= expected - (n#encoded actual)))))) - (_.cover [/.this] - (and (|> (/.result (/.this expected) (list expected)) - (!expect {try.#Success _})) - (|> (/.result (/.this expected) (list dummy)) - (!expect {try.#Failure _})))) - (_.cover [/.somewhere] - (|> (/.result (|> (/.somewhere (/.this expected)) - (<>.before (<>.some /.any))) - (list.together (list pre_ignore (list expected) post_ignore))) - (!expect {try.#Success _}))) - (_.cover [/.end] - (and (|> (/.result /.end (list)) - (!expect {try.#Success _})) - (|> (/.result (<>.not /.end) (list expected)) - (!expect {try.#Failure _})))) - (_.cover [/.named] - (|> (/.result (/.named dummy /.any) (list dummy expected)) - (!expect (^.multi {try.#Success actual} - (text#= expected actual))))) - (_.cover [/.parameter] - (and (|> (/.result (/.parameter [short long] /.any) - (list short expected)) - (!expect (^.multi {try.#Success actual} - (text#= expected actual)))) - (|> (/.result (/.parameter [short long] /.any) - (list long expected)) - (!expect (^.multi {try.#Success actual} - (text#= expected actual)))) - (|> (/.result (/.parameter [short long] /.any) - (list dummy expected)) - (!expect {try.#Failure _})))) + (_.coverage [/.result /.any] + (|> (/.result /.any (list expected)) + (!expect (^.multi {try.#Success actual} + (text#= expected actual))))) + (_.coverage [/.parse] + (|> (/.result (/.parse n#decoded) (list expected)) + (!expect (^.multi {try.#Success actual} + (text#= expected + (n#encoded actual)))))) + (_.coverage [/.this] + (and (|> (/.result (/.this expected) (list expected)) + (!expect {try.#Success _})) + (|> (/.result (/.this expected) (list dummy)) + (!expect {try.#Failure _})))) + (_.coverage [/.somewhere] + (|> (/.result (|> (/.somewhere (/.this expected)) + (<>.before (<>.some /.any))) + (list.together (list pre_ignore (list expected) post_ignore))) + (!expect {try.#Success _}))) + (_.coverage [/.end] + (and (|> (/.result /.end (list)) + (!expect {try.#Success _})) + (|> (/.result (<>.not /.end) (list expected)) + (!expect {try.#Failure _})))) + (_.coverage [/.named] + (|> (/.result (/.named dummy /.any) (list dummy expected)) + (!expect (^.multi {try.#Success actual} + (text#= expected actual))))) + (_.coverage [/.parameter] + (and (|> (/.result (/.parameter [short long] /.any) + (list short expected)) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))) + (|> (/.result (/.parameter [short long] /.any) + (list long expected)) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))) + (|> (/.result (/.parameter [short long] /.any) + (list dummy expected)) + (!expect {try.#Failure _})))) )))) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index 988151880..c4e202aba 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -62,25 +62,25 @@ (`` (all _.and (do [! random.monad] [expected (# ! each code.bit random.bit)] - (_.cover [/.result] - (and (|> (/.result /.any (list expected)) - (!expect {try.#Success _})) - (|> (/.result /.any (list)) - (!expect {try.#Failure _}))))) + (_.coverage [/.result] + (and (|> (/.result /.any (list expected)) + (!expect {try.#Success _})) + (|> (/.result /.any (list)) + (!expect {try.#Failure _}))))) (~~ (template [<query> <check> <random> <code> <equivalence>] [(do [! random.monad] [expected <random> dummy (|> <random> (random.only (|>> (# <equivalence> = expected) not)))] (all _.and - (_.cover [<query>] - (|> (/.result <query> (list (<code> expected))) - (!expect (^.multi {try.#Success actual} - (# <equivalence> = expected actual))))) - (_.cover [<check>] - (and (|> (/.result (<check> expected) (list (<code> expected))) - (!expect {try.#Success []})) - (|> (/.result (<check> expected) (list (<code> dummy))) - (!expect {try.#Failure _})))) + (_.coverage [<query>] + (|> (/.result <query> (list (<code> expected))) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))) + (_.coverage [<check>] + (and (|> (/.result (<check> expected) (list (<code> expected))) + (!expect {try.#Success []})) + (|> (/.result (<check> expected) (list (<code> dummy))) + (!expect {try.#Failure _})))) ))] [/.any /.this (# ! each code.bit random.bit) function.identity code.equivalence] @@ -98,13 +98,13 @@ [(do [! random.monad] [expected_left random.nat expected_right random.int] - (_.cover [<query>] - (|> (/.result (<query> (<>.and /.nat /.int)) - (list (<code> (list (code.nat expected_left) - (code.int expected_right))))) - (!expect (^.multi {try.#Success [actual_left actual_right]} - (and (# nat.equivalence = expected_left actual_left) - (# int.equivalence = expected_right actual_right)))))))] + (_.coverage [<query>] + (|> (/.result (<query> (<>.and /.nat /.int)) + (list (<code> (list (code.nat expected_left) + (code.int expected_right))))) + (!expect (^.multi {try.#Success [actual_left actual_right]} + (and (# nat.equivalence = expected_left actual_left) + (# int.equivalence = expected_right actual_right)))))))] [/.form code.form] [/.variant code.variant] @@ -113,48 +113,48 @@ (do [! random.monad] [expected_local random.nat expected_global random.int] - (_.cover [/.locally] - (|> (/.result (<>.and (/.locally (list (code.nat expected_local)) /.nat) - /.int) - (list (code.int expected_global))) - (!expect (^.multi {try.#Success [actual_local actual_global]} - (and (# nat.equivalence = expected_local actual_local) - (# int.equivalence = expected_global actual_global))))))) + (_.coverage [/.locally] + (|> (/.result (<>.and (/.locally (list (code.nat expected_local)) /.nat) + /.int) + (list (code.int expected_global))) + (!expect (^.multi {try.#Success [actual_local actual_global]} + (and (# nat.equivalence = expected_local actual_local) + (# int.equivalence = expected_global actual_global))))))) (do [! random.monad] [dummy (# ! each code.bit random.bit)] - (_.cover [/.end?] - (|> (/.result (do <>.monad - [pre /.end? - _ /.any - post /.end?] - (in (and (not pre) - post))) - (list dummy)) - (!expect (^.multi {try.#Success verdict} - verdict))))) + (_.coverage [/.end?] + (|> (/.result (do <>.monad + [pre /.end? + _ /.any + post /.end?] + (in (and (not pre) + post))) + (list dummy)) + (!expect (^.multi {try.#Success verdict} + verdict))))) (do [! random.monad] [dummy (# ! each code.bit random.bit)] - (_.cover [/.end] - (and (|> (/.result /.end (list)) - (!expect {try.#Success []})) - (|> (/.result /.end (list dummy)) - (!expect {try.#Failure _}))))) + (_.coverage [/.end] + (and (|> (/.result /.end (list)) + (!expect {try.#Success []})) + (|> (/.result /.end (list dummy)) + (!expect {try.#Failure _}))))) (do [! random.monad] [expected (# ! each code.bit random.bit)] - (_.cover [/.next] - (|> (/.result (do <>.monad - [pre /.next - post /.any] - (in (and (same? expected pre) - (same? pre post)))) - (list expected)) - (!expect {try.#Success _})))) + (_.coverage [/.next] + (|> (/.result (do <>.monad + [pre /.next + post /.any] + (in (and (same? expected pre) + (same? pre post)))) + (list expected)) + (!expect {try.#Success _})))) (do [! random.monad] [expected (# ! each code.bit random.bit)] - (_.cover [/.not] - (and (|> (/.result (/.not /.nat) (list expected)) - (!expect (^.multi {try.#Success actual} - (same? expected actual)))) - (|> (/.result (/.not /.bit) (list expected)) - (!expect {try.#Failure _}))))) + (_.coverage [/.not] + (and (|> (/.result (/.not /.nat) (list expected)) + (!expect (^.multi {try.#Success actual} + (same? expected actual)))) + (|> (/.result (/.not /.bit) (list expected)) + (!expect {try.#Failure _}))))) )))) diff --git a/stdlib/source/test/lux/control/parser/environment.lux b/stdlib/source/test/lux/control/parser/environment.lux index 4c9dafeab..3f1c4bd6d 100644 --- a/stdlib/source/test/lux/control/parser/environment.lux +++ b/stdlib/source/test/lux/control/parser/environment.lux @@ -24,30 +24,30 @@ (<| (_.covering /._) (_.for [/.Environment /.Parser]) (all _.and - (_.cover [/.empty] - (dictionary.empty? /.empty)) + (_.coverage [/.empty] + (dictionary.empty? /.empty)) (do random.monad [expected random.nat] - (_.cover [/.result] - (|> (/.result (//#in expected) /.empty) - (# try.functor each (n.= expected)) - (try.else false)))) + (_.coverage [/.result] + (|> (/.result (//#in expected) /.empty) + (# try.functor each (n.= expected)) + (try.else false)))) (do random.monad [property (random.alphabetic 1) expected (random.alphabetic 1)] - (_.cover [/.Property /.property] - (|> /.empty - (dictionary.has property expected) - (/.result (/.property property)) - (# try.functor each (text#= expected)) - (try.else false)))) + (_.coverage [/.Property /.property] + (|> /.empty + (dictionary.has property expected) + (/.result (/.property property)) + (# try.functor each (text#= expected)) + (try.else false)))) (do random.monad [property (random.alphabetic 1)] - (_.cover [/.unknown_property] - (case (/.result (/.property property) /.empty) - {try.#Success _} - false - - {try.#Failure error} - (exception.match? /.unknown_property error)))) + (_.coverage [/.unknown_property] + (case (/.result (/.property property) /.empty) + {try.#Success _} + false + + {try.#Failure error} + (exception.match? /.unknown_property error)))) ))) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 55387d165..40d48afab 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -49,32 +49,32 @@ (`` (all _.and (do [! random.monad] [expected (# ! each (|>> {json.#String}) (random.unicode 1))] - (_.cover [/.result /.any] - (|> (/.result /.any expected) - (!expect (^.multi {try.#Success actual} - (# json.equivalence = expected actual)))))) - (_.cover [/.null] - (|> (/.result /.null {json.#Null}) - (!expect {try.#Success _}))) + (_.coverage [/.result /.any] + (|> (/.result /.any expected) + (!expect (^.multi {try.#Success actual} + (# json.equivalence = expected actual)))))) + (_.coverage [/.null] + (|> (/.result /.null {json.#Null}) + (!expect {try.#Success _}))) (~~ (template [<query> <test> <check> <random> <json> <equivalence>] [(do [! random.monad] [expected <random> dummy (|> <random> (random.only (|>> (# <equivalence> = expected) not)))] (all _.and - (_.cover [<query>] - (|> (/.result <query> {<json> expected}) - (!expect (^.multi {try.#Success actual} - (# <equivalence> = expected actual))))) - (_.cover [<test>] - (and (|> (/.result (<test> expected) {<json> expected}) - (!expect {try.#Success #1})) - (|> (/.result (<test> expected) {<json> dummy}) - (!expect {try.#Success #0})))) - (_.cover [<check>] - (and (|> (/.result (<check> expected) {<json> expected}) - (!expect {try.#Success _})) - (|> (/.result (<check> expected) {<json> dummy}) - (!expect {try.#Failure _}))))))] + (_.coverage [<query>] + (|> (/.result <query> {<json> expected}) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))) + (_.coverage [<test>] + (and (|> (/.result (<test> expected) {<json> expected}) + (!expect {try.#Success #1})) + (|> (/.result (<test> expected) {<json> dummy}) + (!expect {try.#Success #0})))) + (_.coverage [<check>] + (and (|> (/.result (<check> expected) {<json> expected}) + (!expect {try.#Success _})) + (|> (/.result (<check> expected) {<json> dummy}) + (!expect {try.#Failure _}))))))] [/.boolean /.boolean? /.this_boolean random.bit json.#Boolean bit.equivalence] [/.number /.number? /.this_number ..safe_frac json.#Number frac.equivalence] @@ -83,46 +83,46 @@ (do [! random.monad] [expected (random.unicode 1) dummy random.bit] - (_.cover [/.unexpected_value] - (|> (/.result /.string {json.#Boolean dummy}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unexpected_value error)))))) + (_.coverage [/.unexpected_value] + (|> (/.result /.string {json.#Boolean dummy}) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unexpected_value error)))))) (do [! random.monad] [expected (random.unicode 1) dummy (|> (random.unicode 1) (random.only (|>> (# text.equivalence = expected) not)))] - (_.cover [/.value_mismatch] - (|> (/.result (/.this_string expected) {json.#String dummy}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.value_mismatch error)))))) + (_.coverage [/.value_mismatch] + (|> (/.result (/.this_string expected) {json.#String dummy}) + (!expect (^.multi {try.#Failure error} + (exception.match? /.value_mismatch error)))))) (do [! random.monad] [expected (random.unicode 1)] - (_.cover [/.nullable] - (and (|> (/.result (/.nullable /.string) {json.#Null}) - (!expect (^.multi {try.#Success actual} - (# (maybe.equivalence text.equivalence) = {.#None} actual)))) - (|> (/.result (/.nullable /.string) {json.#String expected}) - (!expect (^.multi {try.#Success actual} - (# (maybe.equivalence text.equivalence) = {.#Some expected} actual))))))) + (_.coverage [/.nullable] + (and (|> (/.result (/.nullable /.string) {json.#Null}) + (!expect (^.multi {try.#Success actual} + (# (maybe.equivalence text.equivalence) = {.#None} actual)))) + (|> (/.result (/.nullable /.string) {json.#String expected}) + (!expect (^.multi {try.#Success actual} + (# (maybe.equivalence text.equivalence) = {.#Some expected} actual))))))) (do [! random.monad] [size (# ! each (n.% 10) random.nat) expected (|> (random.unicode 1) (random.list size) (# ! each sequence.of_list))] - (_.cover [/.array] - (|> (/.result (/.array (<>.some /.string)) - {json.#Array (sequence#each (|>> {json.#String}) expected)}) - (!expect (^.multi {try.#Success actual} - (# (sequence.equivalence text.equivalence) = expected (sequence.of_list actual))))))) + (_.coverage [/.array] + (|> (/.result (/.array (<>.some /.string)) + {json.#Array (sequence#each (|>> {json.#String}) expected)}) + (!expect (^.multi {try.#Success actual} + (# (sequence.equivalence text.equivalence) = expected (sequence.of_list actual))))))) (do [! random.monad] [expected (# ! each (|>> {json.#String}) (random.unicode 1))] - (_.cover [/.unconsumed_input] - (|> (/.result (/.array /.any) {json.#Array (sequence expected expected)}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unconsumed_input error)))))) - (_.cover [/.empty_input] - (|> (/.result (/.array /.any) {json.#Array (sequence)}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.empty_input error))))) + (_.coverage [/.unconsumed_input] + (|> (/.result (/.array /.any) {json.#Array (sequence expected expected)}) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error)))))) + (_.coverage [/.empty_input] + (|> (/.result (/.array /.any) {json.#Array (sequence)}) + (!expect (^.multi {try.#Failure error} + (exception.match? /.empty_input error))))) (do [! random.monad] [expected_boolean random.bit expected_number ..safe_frac @@ -135,32 +135,32 @@ _ (undefined)))))] - (_.cover [/.object /.field] - (|> (/.result (/.object (all <>.and - (/.field boolean_field /.boolean) - (/.field number_field /.number) - (/.field string_field /.string))) - {json.#Object - (dictionary.of_list text.hash - (list [boolean_field {json.#Boolean expected_boolean}] - [number_field {json.#Number expected_number}] - [string_field {json.#String expected_string}]))}) - (!expect (^.multi {try.#Success [actual_boolean actual_number actual_string]} - (and (# bit.equivalence = expected_boolean actual_boolean) - (# frac.equivalence = expected_number actual_number) - (# text.equivalence = expected_string actual_string))))))) + (_.coverage [/.object /.field] + (|> (/.result (/.object (all <>.and + (/.field boolean_field /.boolean) + (/.field number_field /.number) + (/.field string_field /.string))) + {json.#Object + (dictionary.of_list text.hash + (list [boolean_field {json.#Boolean expected_boolean}] + [number_field {json.#Number expected_number}] + [string_field {json.#String expected_string}]))}) + (!expect (^.multi {try.#Success [actual_boolean actual_number actual_string]} + (and (# bit.equivalence = expected_boolean actual_boolean) + (# frac.equivalence = expected_number actual_number) + (# text.equivalence = expected_string actual_string))))))) (do [! random.monad] [size (# ! each (n.% 10) random.nat) keys (random.list size (random.unicode 1)) values (random.list size (random.unicode 1)) .let [expected (dictionary.of_list text.hash (list.zipped_2 keys values))]] - (_.cover [/.dictionary] - (|> (/.result (/.dictionary /.string) - {json.#Object - (|> values - (list#each (|>> {json.#String})) - (list.zipped_2 keys) - (dictionary.of_list text.hash))}) - (!expect (^.multi {try.#Success actual} - (# (dictionary.equivalence text.equivalence) = expected actual)))))) + (_.coverage [/.dictionary] + (|> (/.result (/.dictionary /.string) + {json.#Object + (|> values + (list#each (|>> {json.#String})) + (list.zipped_2 keys) + (dictionary.of_list text.hash))}) + (!expect (^.multi {try.#Success actual} + (# (dictionary.equivalence text.equivalence) = expected actual)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index addb7c149..4cf859a46 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -68,16 +68,16 @@ [expected <random> dummy (|> <random> (random.only (|>> (# <equivalence> = expected) not)))] (all _.and - (_.cover [<query>] - (|> (/.result <query> (list (<synthesis> expected))) - (!expect (^.multi {try.#Success actual} - (# <equivalence> = expected actual))))) - (_.cover [<check>] - (and (|> (/.result (<check> expected) (list (<synthesis> expected))) - (!expect {try.#Success _})) - (|> (/.result (<check> expected) (list (<synthesis> dummy))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_parse error)))))) + (_.coverage [<query>] + (|> (/.result <query> (list (<synthesis> expected))) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))) + (_.coverage [<check>] + (and (|> (/.result (<check> expected) (list (<synthesis> expected))) + (!expect {try.#Success _})) + (|> (/.result (<check> expected) (list (<synthesis> dummy))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error)))))) ))] [/.bit /.this_bit random.bit synthesis.bit bit.equivalence] @@ -98,66 +98,66 @@ expected_i64 random.i64 expected_f64 random.safe_frac expected_text (random.unicode 1)] - (_.cover [/.tuple] - (and (|> (/.result (/.tuple (all <>.and /.bit /.i64 /.f64 /.text)) - (list (synthesis.tuple (list (synthesis.bit expected_bit) - (synthesis.i64 expected_i64) - (synthesis.f64 expected_f64) - (synthesis.text expected_text))))) - (!expect (^.multi {try.#Success [actual_bit actual_i64 actual_f64 actual_text]} - (and (# bit.equivalence = expected_bit actual_bit) - (# i64.equivalence = expected_i64 actual_i64) - (# frac.equivalence = expected_f64 actual_f64) - (# text.equivalence = expected_text actual_text))))) - (|> (/.result (/.tuple (all <>.and /.bit /.i64 /.f64 /.text)) - (list (synthesis.text expected_text))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (_.coverage [/.tuple] + (and (|> (/.result (/.tuple (all <>.and /.bit /.i64 /.f64 /.text)) + (list (synthesis.tuple (list (synthesis.bit expected_bit) + (synthesis.i64 expected_i64) + (synthesis.f64 expected_f64) + (synthesis.text expected_text))))) + (!expect (^.multi {try.#Success [actual_bit actual_i64 actual_f64 actual_text]} + (and (# bit.equivalence = expected_bit actual_bit) + (# i64.equivalence = expected_i64 actual_i64) + (# frac.equivalence = expected_f64 actual_f64) + (# text.equivalence = expected_text actual_text))))) + (|> (/.result (/.tuple (all <>.and /.bit /.i64 /.f64 /.text)) + (list (synthesis.text expected_text))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) (do [! random.monad] [arity random.nat expected_environment ..random_environment expected_body (random.unicode 1)] - (_.cover [/.function] - (and (|> (/.result (/.function arity /.text) - (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) - (!expect (^.multi {try.#Success [actual_environment actual_body]} - (and (# (list.equivalence synthesis.equivalence) = - expected_environment - actual_environment) - (# text.equivalence = expected_body actual_body))))) - (|> (/.result (/.function arity /.text) - (list (synthesis.text expected_body))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (_.coverage [/.function] + (and (|> (/.result (/.function arity /.text) + (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) + (!expect (^.multi {try.#Success [actual_environment actual_body]} + (and (# (list.equivalence synthesis.equivalence) = + expected_environment + actual_environment) + (# text.equivalence = expected_body actual_body))))) + (|> (/.result (/.function arity /.text) + (list (synthesis.text expected_body))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) (do [! random.monad] [arity random.nat expected_environment ..random_environment expected_body (random.unicode 1)] - (_.cover [/.wrong_arity] - (|> (/.result (/.function (++ arity) /.text) - (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.wrong_arity error)))))) + (_.coverage [/.wrong_arity] + (|> (/.result (/.function (++ arity) /.text) + (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.wrong_arity error)))))) (do [! random.monad] [arity (# ! each (|>> (n.% 10) ++) random.nat) expected_offset random.nat expected_inits (random.list arity random.bit) expected_body (random.unicode 1)] - (_.cover [/.loop] - (and (|> (/.result (/.loop (<>.many /.bit) /.text) - (list (synthesis.loop/scope [expected_offset - (list#each (|>> synthesis.bit) expected_inits) - (synthesis.text expected_body)]))) - (!expect (^.multi {try.#Success [actual_offset actual_inits actual_body]} - (and (# n.equivalence = expected_offset actual_offset) - (# (list.equivalence bit.equivalence) = - expected_inits - actual_inits) - (# text.equivalence = expected_body actual_body))))) - (|> (/.result (/.loop (<>.many /.bit) /.text) - (list (synthesis.text expected_body))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (_.coverage [/.loop] + (and (|> (/.result (/.loop (<>.many /.bit) /.text) + (list (synthesis.loop/scope [expected_offset + (list#each (|>> synthesis.bit) expected_inits) + (synthesis.text expected_body)]))) + (!expect (^.multi {try.#Success [actual_offset actual_inits actual_body]} + (and (# n.equivalence = expected_offset actual_offset) + (# (list.equivalence bit.equivalence) = + expected_inits + actual_inits) + (# text.equivalence = expected_body actual_body))))) + (|> (/.result (/.loop (<>.many /.bit) /.text) + (list (synthesis.text expected_body))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) )) (def: .public test @@ -167,35 +167,35 @@ (all _.and (do [! random.monad] [expected (# ! each (|>> synthesis.i64) random.i64)] - (_.cover [/.result /.any] - (|> (/.result /.any (list expected)) - (!expect (^.multi {try.#Success actual} - (# synthesis.equivalence = expected actual)))))) - (_.cover [/.empty_input] - (|> (/.result /.any (list)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.empty_input error))))) + (_.coverage [/.result /.any] + (|> (/.result /.any (list expected)) + (!expect (^.multi {try.#Success actual} + (# synthesis.equivalence = expected actual)))))) + (_.coverage [/.empty_input] + (|> (/.result /.any (list)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.empty_input error))))) (do [! random.monad] [expected (# ! each (|>> synthesis.i64) random.i64)] - (_.cover [/.unconsumed_input] - (|> (/.result /.any (list expected expected)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unconsumed_input error)))))) + (_.coverage [/.unconsumed_input] + (|> (/.result /.any (list expected expected)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error)))))) (do [! random.monad] [dummy (# ! each (|>> synthesis.i64) random.i64)] - (_.cover [/.end /.expected_empty_input] - (and (|> (/.result /.end (list)) - (!expect {try.#Success _})) - (|> (/.result /.end (list dummy)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.expected_empty_input error))))))) + (_.coverage [/.end /.expected_empty_input] + (and (|> (/.result /.end (list)) + (!expect {try.#Success _})) + (|> (/.result /.end (list dummy)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.expected_empty_input error))))))) (do [! random.monad] [dummy (# ! each (|>> synthesis.i64) random.i64)] - (_.cover [/.end?] - (and (|> (/.result /.end? (list)) - (!expect {try.#Success #1})) - (|> (/.result (<>.before /.any /.end?) (list dummy)) - (!expect {try.#Success #0}))))) + (_.coverage [/.end?] + (and (|> (/.result /.end? (list)) + (!expect {try.#Success #1})) + (|> (/.result (<>.before /.any /.end?) (list dummy)) + (!expect {try.#Success #0}))))) (_.for [/.cannot_parse] (all _.and ..simple diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index eb09bad2a..94f067ef7 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -80,50 +80,50 @@ out_of_range (case offset 0 (# ! each (|>> (n.% 10) ++ (n.+ limit) text.of_char) random.nat) _ (# ! each (|>> (n.% offset) text.of_char) random.nat))] - (_.cover [/.range] - (and (..should_pass expected (/.range offset limit)) - (..should_fail out_of_range (/.range offset limit))))) + (_.coverage [/.range] + (and (..should_pass expected (/.range offset limit)) + (..should_fail out_of_range (/.range offset limit))))) (do [! random.monad] [expected (random.char unicode.upper_case) invalid (random.only (|>> (unicode/block.within? unicode/block.upper_case) not) (random.char unicode.character))] - (_.cover [/.upper] - (and (..should_pass (text.of_char expected) /.upper) - (..should_fail (text.of_char invalid) /.upper)))) + (_.coverage [/.upper] + (and (..should_pass (text.of_char expected) /.upper) + (..should_fail (text.of_char invalid) /.upper)))) (do [! random.monad] [expected (random.char unicode.lower_case) invalid (random.only (|>> (unicode/block.within? unicode/block.lower_case) not) (random.char unicode.character))] - (_.cover [/.lower] - (and (..should_pass (text.of_char expected) /.lower) - (..should_fail (text.of_char invalid) /.lower)))) + (_.coverage [/.lower] + (and (..should_pass (text.of_char expected) /.lower) + (..should_fail (text.of_char invalid) /.lower)))) (do [! random.monad] [expected (# ! each (n.% 10) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] - (_.cover [/.decimal] - (and (..should_pass (# n.decimal encoded expected) /.decimal) - (..should_fail (text.of_char invalid) /.decimal)))) + (_.coverage [/.decimal] + (and (..should_pass (# n.decimal encoded expected) /.decimal) + (..should_fail (text.of_char invalid) /.decimal)))) (do [! random.monad] [expected (# ! each (n.% 8) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] - (_.cover [/.octal] - (and (..should_pass (# n.octal encoded expected) /.octal) - (..should_fail (text.of_char invalid) /.octal)))) + (_.coverage [/.octal] + (and (..should_pass (# n.octal encoded expected) /.octal) + (..should_fail (text.of_char invalid) /.octal)))) (do [! random.monad] [expected (# ! each (n.% 16) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] - (_.cover [/.hexadecimal] - (and (..should_pass (# n.hex encoded expected) /.hexadecimal) - (..should_fail (text.of_char invalid) /.hexadecimal)))) + (_.coverage [/.hexadecimal] + (and (..should_pass (# n.hex encoded expected) /.hexadecimal) + (..should_fail (text.of_char invalid) /.hexadecimal)))) (do [! random.monad] [expected (random.char unicode.alphabetic) invalid (random.only (function (_ char) (not (or (unicode/block.within? unicode/block.upper_case char) (unicode/block.within? unicode/block.lower_case char)))) (random.char unicode.character))] - (_.cover [/.alpha] - (and (..should_pass (text.of_char expected) /.alpha) - (..should_fail (text.of_char invalid) /.alpha)))) + (_.coverage [/.alpha] + (and (..should_pass (text.of_char expected) /.alpha) + (..should_fail (text.of_char invalid) /.alpha)))) (do [! random.monad] [expected (random.char unicode.alpha_numeric) invalid (random.only (function (_ char) @@ -131,9 +131,9 @@ (unicode/block.within? unicode/block.lower_case char) (unicode/block.within? unicode/block.numeric char)))) (random.char unicode.character))] - (_.cover [/.alpha_num] - (and (..should_pass (text.of_char expected) /.alpha_num) - (..should_fail (text.of_char invalid) /.alpha_num)))) + (_.coverage [/.alpha_num] + (and (..should_pass (text.of_char expected) /.alpha_num) + (..should_fail (text.of_char invalid) /.alpha_num)))) (do [! random.monad] [expected (all random.either (in text.tab) @@ -149,9 +149,9 @@ (text#= text.new_line char) (text#= text.carriage_return char) (text#= text.form_feed char))))))] - (_.cover [/.space] - (and (..should_pass expected /.space) - (..should_fail invalid /.space)))) + (_.coverage [/.space] + (and (..should_pass expected /.space) + (..should_fail invalid /.space)))) (do [! random.monad] [.let [num_options 3] options (|> (random.char unicode.character) @@ -167,17 +167,17 @@ invalid (random.only (function (_ char) (not (text.contains? (text.of_char char) options))) (random.char unicode.character))] - (_.cover [/.one_of /.one_of! /.character_should_be] - (and (..should_pass (text.of_char expected) (/.one_of options)) - (..should_fail (text.of_char invalid) (/.one_of options)) - (..should_fail' (text.of_char invalid) (/.one_of options) - /.character_should_be) + (_.coverage [/.one_of /.one_of! /.character_should_be] + (and (..should_pass (text.of_char expected) (/.one_of options)) + (..should_fail (text.of_char invalid) (/.one_of options)) + (..should_fail' (text.of_char invalid) (/.one_of options) + /.character_should_be) - (..should_pass! (text.of_char expected) (/.one_of! options)) - (..should_fail (text.of_char invalid) (/.one_of! options)) - (..should_fail' (text.of_char invalid) (/.one_of! options) - /.character_should_be) - ))) + (..should_pass! (text.of_char expected) (/.one_of! options)) + (..should_fail (text.of_char invalid) (/.one_of! options)) + (..should_fail' (text.of_char invalid) (/.one_of! options) + /.character_should_be) + ))) (do [! random.monad] [.let [num_options 3] options (|> (random.char unicode.character) @@ -193,17 +193,17 @@ expected (random.only (function (_ char) (not (text.contains? (text.of_char char) options))) (random.char unicode.character))] - (_.cover [/.none_of /.none_of! /.character_should_not_be] - (and (..should_pass (text.of_char expected) (/.none_of options)) - (..should_fail (text.of_char invalid) (/.none_of options)) - (..should_fail' (text.of_char invalid) (/.none_of options) - /.character_should_not_be) + (_.coverage [/.none_of /.none_of! /.character_should_not_be] + (and (..should_pass (text.of_char expected) (/.none_of options)) + (..should_fail (text.of_char invalid) (/.none_of options)) + (..should_fail' (text.of_char invalid) (/.none_of options) + /.character_should_not_be) - (..should_pass! (text.of_char expected) (/.none_of! options)) - (..should_fail (text.of_char invalid) (/.none_of! options)) - (..should_fail' (text.of_char invalid) (/.none_of! options) - /.character_should_not_be) - ))) + (..should_pass! (text.of_char expected) (/.none_of! options)) + (..should_fail (text.of_char invalid) (/.none_of! options)) + (..should_fail' (text.of_char invalid) (/.none_of! options) + /.character_should_not_be) + ))) )) (def: runs @@ -218,11 +218,11 @@ (# ! each (n.% 16)) (random.only (n.>= 8)) (# ! each (# n.hex encoded)))] - (_.cover [/.many /.many!] - (and (..should_pass expected (/.many /.octal)) - (..should_fail invalid (/.many /.octal)) + (_.coverage [/.many /.many!] + (and (..should_pass expected (/.many /.octal)) + (..should_fail invalid (/.many /.octal)) - (..should_pass! expected (/.many! octal!))))) + (..should_pass! expected (/.many! octal!))))) (do [! random.monad] [left (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat) right (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat) @@ -231,65 +231,65 @@ (# ! each (n.% 16)) (random.only (n.>= 8)) (# ! each (# n.hex encoded)))] - (_.cover [/.some /.some!] - (and (..should_pass expected (/.some /.octal)) - (..should_pass "" (/.some /.octal)) - (..should_fail invalid (/.some /.octal)) + (_.coverage [/.some /.some!] + (and (..should_pass expected (/.some /.octal)) + (..should_pass "" (/.some /.octal)) + (..should_fail invalid (/.some /.octal)) - (..should_pass! expected (/.some! octal!)) - (..should_pass! "" (/.some! octal!))))) + (..should_pass! expected (/.some! octal!)) + (..should_pass! "" (/.some! octal!))))) (do [! random.monad] [.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)] first octal second octal third octal] - (_.cover [/.exactly /.exactly!] - (and (..should_pass (format first second) (/.exactly 2 /.octal)) - (..should_fail (format first second third) (/.exactly 2 /.octal)) - (..should_fail (format first) (/.exactly 2 /.octal)) + (_.coverage [/.exactly /.exactly!] + (and (..should_pass (format first second) (/.exactly 2 /.octal)) + (..should_fail (format first second third) (/.exactly 2 /.octal)) + (..should_fail (format first) (/.exactly 2 /.octal)) - (..should_pass! (format first second) (/.exactly! 2 octal!)) - (..should_fail (format first second third) (/.exactly! 2 octal!)) - (..should_fail (format first) (/.exactly! 2 octal!))))) + (..should_pass! (format first second) (/.exactly! 2 octal!)) + (..should_fail (format first second third) (/.exactly! 2 octal!)) + (..should_fail (format first) (/.exactly! 2 octal!))))) (do [! random.monad] [.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)] first octal second octal third octal] - (_.cover [/.at_most /.at_most!] - (and (..should_pass (format first second) (/.at_most 2 /.octal)) - (..should_pass (format first) (/.at_most 2 /.octal)) - (..should_fail (format first second third) (/.at_most 2 /.octal)) + (_.coverage [/.at_most /.at_most!] + (and (..should_pass (format first second) (/.at_most 2 /.octal)) + (..should_pass (format first) (/.at_most 2 /.octal)) + (..should_fail (format first second third) (/.at_most 2 /.octal)) - (..should_pass! (format first second) (/.at_most! 2 octal!)) - (..should_pass! (format first) (/.at_most! 2 octal!)) - (..should_fail (format first second third) (/.at_most! 2 octal!))))) + (..should_pass! (format first second) (/.at_most! 2 octal!)) + (..should_pass! (format first) (/.at_most! 2 octal!)) + (..should_fail (format first second third) (/.at_most! 2 octal!))))) (do [! random.monad] [.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)] first octal second octal third octal] - (_.cover [/.at_least /.at_least!] - (and (..should_pass (format first second) (/.at_least 2 /.octal)) - (..should_pass (format first second third) (/.at_least 2 /.octal)) - (..should_fail (format first) (/.at_least 2 /.octal)) + (_.coverage [/.at_least /.at_least!] + (and (..should_pass (format first second) (/.at_least 2 /.octal)) + (..should_pass (format first second third) (/.at_least 2 /.octal)) + (..should_fail (format first) (/.at_least 2 /.octal)) - (..should_pass! (format first second) (/.at_least! 2 octal!)) - (..should_pass! (format first second third) (/.at_least! 2 octal!)) - (..should_fail (format first) (/.at_least! 2 octal!))))) + (..should_pass! (format first second) (/.at_least! 2 octal!)) + (..should_pass! (format first second third) (/.at_least! 2 octal!)) + (..should_fail (format first) (/.at_least! 2 octal!))))) (do [! random.monad] [.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)] first octal second octal third octal] - (_.cover [/.between /.between!] - (and (..should_pass (format first second) (/.between 2 1 /.octal)) - (..should_pass (format first second third) (/.between 2 1 /.octal)) - (..should_fail (format first) (/.between 2 1 /.octal)) + (_.coverage [/.between /.between!] + (and (..should_pass (format first second) (/.between 2 1 /.octal)) + (..should_pass (format first second third) (/.between 2 1 /.octal)) + (..should_fail (format first) (/.between 2 1 /.octal)) - (..should_pass! (format first second) (/.between! 2 1 octal!)) - (..should_pass! (format first second third) (/.between! 2 1 octal!)) - (..should_fail (format first) (/.between! 2 1 octal!))))) + (..should_pass! (format first second) (/.between! 2 1 octal!)) + (..should_pass! (format first second third) (/.between! 2 1 octal!)) + (..should_fail (format first) (/.between! 2 1 octal!))))) ))) (def: .public test @@ -299,121 +299,121 @@ (all _.and (do [! random.monad] [sample (random.unicode 1)] - (_.cover [/.result /.end] - (and (|> (/.result /.end - "") - (!expect {try.#Success _})) - (|> (/.result /.end - sample) - (!expect {try.#Failure _}))))) + (_.coverage [/.result /.end] + (and (|> (/.result /.end + "") + (!expect {try.#Success _})) + (|> (/.result /.end + sample) + (!expect {try.#Failure _}))))) (do [! random.monad] [.let [size 10] expected (random.unicode size) dummy (|> (random.unicode size) (random.only (|>> (text#= expected) not)))] - (_.cover [/.this /.cannot_match] - (and (|> (/.result (/.this expected) - expected) - (!expect {try.#Success []})) - (|> (/.result (/.this expected) - dummy) - (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_match error))))))) - (_.cover [/.Slice /.slice /.cannot_slice] - (|> "" - (/.result (/.slice /.any!)) + (_.coverage [/.this /.cannot_match] + (and (|> (/.result (/.this expected) + expected) + (!expect {try.#Success []})) + (|> (/.result (/.this expected) + dummy) (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_slice error))))) + (exception.match? /.cannot_match error))))))) + (_.coverage [/.Slice /.slice /.cannot_slice] + (|> "" + (/.result (/.slice /.any!)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_slice error))))) (do [! random.monad] [expected (random.unicode 1)] - (_.cover [/.any /.any!] - (and (..should_pass expected /.any) - (..should_fail "" /.any) + (_.coverage [/.any /.any!] + (and (..should_pass expected /.any) + (..should_fail "" /.any) - (..should_pass! expected /.any!) - (..should_fail "" /.any!)))) + (..should_pass! expected /.any!) + (..should_fail "" /.any!)))) (do [! random.monad] [expected (random.unicode 1)] - (_.cover [/.next /.cannot_parse] - (and (..should_pass expected (<>.before /.any /.next)) - (|> "" - (/.result (<>.before /.any /.next)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (_.coverage [/.next /.cannot_parse] + (and (..should_pass expected (<>.before /.any /.next)) + (|> "" + (/.result (<>.before /.any /.next)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) (do [! random.monad] [dummy (random.unicode 1)] - (_.cover [/.unconsumed_input] - (|> (format dummy dummy) - (/.result /.any) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unconsumed_input error)))))) + (_.coverage [/.unconsumed_input] + (|> (format dummy dummy) + (/.result /.any) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error)))))) (do [! random.monad] [sample (random.unicode 1)] - (_.cover [/.Offset /.offset] - (|> sample - (/.result (do <>.monad - [pre /.offset - _ /.any - post /.offset] - (in [pre post]))) - (!expect {try.#Success [0 1]})))) + (_.coverage [/.Offset /.offset] + (|> sample + (/.result (do <>.monad + [pre /.offset + _ /.any + post /.offset] + (in [pre post]))) + (!expect {try.#Success [0 1]})))) (do [! random.monad] [left (random.unicode 1) right (random.unicode 1) .let [input (format left right)]] - (_.cover [/.remaining] - (|> input - (/.result (do <>.monad - [pre /.remaining - _ /.any - post /.remaining - _ /.any] - (in (and (text#= input pre) - (text#= right post))))) - (!expect {try.#Success #1})))) + (_.coverage [/.remaining] + (|> input + (/.result (do <>.monad + [pre /.remaining + _ /.any + post /.remaining + _ /.any] + (in (and (text#= input pre) + (text#= right post))))) + (!expect {try.#Success #1})))) (do [! random.monad] [left (random.unicode 1) right (random.unicode 1) expected (random.only (|>> (text#= right) not) (random.unicode 1))] - (_.cover [/.enclosed] - (|> (format left expected right) - (/.result (/.enclosed [left right] (/.this expected))) - (!expect {try.#Success _})))) + (_.coverage [/.enclosed] + (|> (format left expected right) + (/.result (/.enclosed [left right] (/.this expected))) + (!expect {try.#Success _})))) (do [! random.monad] [input (random.unicode 1) output (random.unicode 1)] - (_.cover [/.local] - (|> output - (/.result (do <>.monad - [_ (/.local input (/.this input))] - (/.this output))) - (!expect {try.#Success _})))) + (_.coverage [/.local] + (|> output + (/.result (do <>.monad + [_ (/.local input (/.this input))] + (/.this output))) + (!expect {try.#Success _})))) (do [! random.monad] [expected (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)] - (_.cover [/.then] - (|> (list (code.text expected)) - (<c>.result (/.then /.octal <c>.text)) - (!expect (^.multi {try.#Success actual} - (text#= expected actual)))))) + (_.coverage [/.then] + (|> (list (code.text expected)) + (<c>.result (/.then /.octal <c>.text)) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))))) (do [! random.monad] [invalid (random.upper_case 1) expected (random.only (|>> (unicode/block.within? unicode/block.upper_case) not) (random.char unicode.character)) .let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]] - (_.cover [/.not /.not! /.expected_to_fail] - (and (..should_pass (text.of_char expected) (/.not /.upper)) - (|> invalid - (/.result (/.not /.upper)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.expected_to_fail error)))) + (_.coverage [/.not /.not! /.expected_to_fail] + (and (..should_pass (text.of_char expected) (/.not /.upper)) + (|> invalid + (/.result (/.not /.upper)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.expected_to_fail error)))) - (..should_pass! (text.of_char expected) (/.not! upper!)) - (|> invalid - (/.result (/.not! upper!)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.expected_to_fail error))))))) + (..should_pass! (text.of_char expected) (/.not! upper!)) + (|> invalid + (/.result (/.not! upper!)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.expected_to_fail error))))))) (do [! random.monad] [upper (random.upper_case 1) lower (random.lower_case 1) @@ -423,21 +423,21 @@ (random.char unicode.character)) .let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ") lower! (/.one_of! "abcdefghijklmnopqrstuvwxyz")]] - (_.cover [/.and /.and!] - (and (..should_pass (format upper lower) (/.and /.upper /.lower)) - (..should_fail (format (text.of_char invalid) lower) (/.and /.upper /.lower)) - (..should_fail (format upper (text.of_char invalid)) (/.and /.upper /.lower)) + (_.coverage [/.and /.and!] + (and (..should_pass (format upper lower) (/.and /.upper /.lower)) + (..should_fail (format (text.of_char invalid) lower) (/.and /.upper /.lower)) + (..should_fail (format upper (text.of_char invalid)) (/.and /.upper /.lower)) - (..should_pass! (format upper lower) (/.and! upper! lower!)) - (..should_fail (format (text.of_char invalid) lower) (/.and! upper! lower!)) - (..should_fail (format upper (text.of_char invalid)) (/.and! upper! lower!))))) + (..should_pass! (format upper lower) (/.and! upper! lower!)) + (..should_fail (format (text.of_char invalid) lower) (/.and! upper! lower!)) + (..should_fail (format upper (text.of_char invalid)) (/.and! upper! lower!))))) (do [! random.monad] [expected (random.unicode 1) invalid (random.unicode 1)] - (_.cover [/.satisfies /.character_does_not_satisfy_predicate] - (and (..should_pass expected (/.satisfies (function.constant true))) - (..should_fail' invalid (/.satisfies (function.constant false)) - /.character_does_not_satisfy_predicate)))) + (_.coverage [/.satisfies /.character_does_not_satisfy_predicate] + (and (..should_pass expected (/.satisfies (function.constant true))) + (..should_fail' invalid (/.satisfies (function.constant false)) + /.character_does_not_satisfy_predicate)))) ..character_classes ..runs ))) diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux index 4d014f42d..391e90014 100644 --- a/stdlib/source/test/lux/control/parser/tree.lux +++ b/stdlib/source/test/lux/control/parser/tree.lux @@ -33,23 +33,23 @@ [(do [! random.monad] [dummy random.nat expected (|> random.nat (random.only (|>> (n.= dummy) not)))] - (_.cover <coverage> - (|> (/.result <parser> - <sample>) - (!expect (^.multi {try.#Success actual} - (n.= expected actual))))))]) + (_.coverage <coverage> + (|> (/.result <parser> + <sample>) + (!expect (^.multi {try.#Success actual} + (n.= expected actual))))))]) (template: (!cover/2 <coverage> <parser> <sample0> <sample1>) [(do [! random.monad] [dummy random.nat expected (|> random.nat (random.only (|>> (n.= dummy) not)))] - (_.cover <coverage> - (and (|> (/.result <parser> <sample0>) - (!expect (^.multi {try.#Success actual} - (n.= expected actual)))) - (|> (/.result <parser> <sample1>) - (!expect (^.multi {try.#Success actual} - (n.= expected actual)))))))]) + (_.coverage <coverage> + (and (|> (/.result <parser> <sample0>) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))) + (|> (/.result <parser> <sample1>) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))))))]) (def: .public test Test @@ -61,11 +61,11 @@ (tree.leaf expected)) (do [! random.monad] [expected random.nat] - (_.cover [/.result'] - (|> (/.result' /.value - (zipper.zipper (tree.leaf expected))) - (!expect (^.multi {try.#Success actual} - (n.= expected actual)))))) + (_.coverage [/.result'] + (|> (/.result' /.value + (zipper.zipper (tree.leaf expected))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))))) (!cover [/.down] (do //.monad [_ /.down] @@ -161,15 +161,15 @@ (tree.leaf dummy)))) (do [! random.monad] [dummy random.nat] - (_.cover [/.cannot_move_further] - (`` (and (~~ (template [<parser>] - [(|> (/.result <parser> - (tree.leaf dummy)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.cannot_move_further error))))] + (_.coverage [/.cannot_move_further] + (`` (and (~~ (template [<parser>] + [(|> (/.result <parser> + (tree.leaf dummy)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_move_further error))))] - [/.down] [/.up] - [/.right] [/.left] - [/.next] [/.previous] - )))))) + [/.down] [/.up] + [/.right] [/.left] + [/.next] [/.previous] + )))))) ))) diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index a64688a8d..66f5114db 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -47,32 +47,32 @@ dummy (random.only (|>> (type#= expected) not) ..primitive)]) (all _.and - (_.cover [/.exactly] - (and (|> (/.result (/.exactly expected) expected) - (!expect {try.#Success []})) - (|> (/.result (/.exactly expected) dummy) - (!expect (^.multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) - (_.cover [/.sub] - (and (|> (/.result (/.sub expected) expected) - (!expect {try.#Success []})) - (|> (/.result (/.sub Any) expected) - (!expect {try.#Success []})) - (|> (/.result (/.sub expected) Nothing) - (!expect {try.#Success []})) - (|> (/.result (/.sub expected) dummy) - (!expect (^.multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) - (_.cover [/.super] - (and (|> (/.result (/.super expected) expected) - (!expect {try.#Success []})) - (|> (/.result (/.super expected) Any) - (!expect {try.#Success []})) - (|> (/.result (/.super Nothing) expected) - (!expect {try.#Success []})) - (|> (/.result (/.super expected) dummy) - (!expect (^.multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) + (_.coverage [/.exactly] + (and (|> (/.result (/.exactly expected) expected) + (!expect {try.#Success []})) + (|> (/.result (/.exactly expected) dummy) + (!expect (^.multi {try.#Failure error} + (exception.match? /.types_do_not_match error)))))) + (_.coverage [/.sub] + (and (|> (/.result (/.sub expected) expected) + (!expect {try.#Success []})) + (|> (/.result (/.sub Any) expected) + (!expect {try.#Success []})) + (|> (/.result (/.sub expected) Nothing) + (!expect {try.#Success []})) + (|> (/.result (/.sub expected) dummy) + (!expect (^.multi {try.#Failure error} + (exception.match? /.types_do_not_match error)))))) + (_.coverage [/.super] + (and (|> (/.result (/.super expected) expected) + (!expect {try.#Success []})) + (|> (/.result (/.super expected) Any) + (!expect {try.#Success []})) + (|> (/.result (/.super Nothing) expected) + (!expect {try.#Success []})) + (|> (/.result (/.super expected) dummy) + (!expect (^.multi {try.#Failure error} + (exception.match? /.types_do_not_match error)))))) ))) (def: test|aggregate @@ -83,44 +83,44 @@ expected_right ..primitive] (`` (all _.and (~~ (template [<parser> <exception> <good_constructor> <bad_constructor>] - [(_.cover [<parser> <exception>] - (and (|> (/.result (<parser> (all //.and /.any /.any /.any)) - (<good_constructor> (list expected_left expected_middle expected_right))) - (!expect (^.multi {try.#Success [actual_left actual_middle actual_right]} - (and (type#= expected_left actual_left) - (type#= expected_middle actual_middle) - (type#= expected_right actual_right))))) - (|> (/.result (<parser> (all //.and /.any /.any /.any)) - (<bad_constructor> (list expected_left expected_middle expected_right))) - (!expect (^.multi {try.#Failure error} - (exception.match? <exception> error))))))] - - [/.variant /.not_variant type.variant type.tuple] - [/.tuple /.not_tuple type.tuple type.variant] - )) - - (_.cover [/.function /.not_function] - (and (|> (/.result (/.function (all //.and /.any /.any) /.any) - (type.function (list expected_left expected_middle) expected_right)) - (!expect (^.multi {try.#Success [[actual_left actual_middle] actual_right]} - (and (type#= expected_left actual_left) - (type#= expected_middle actual_middle) - (type#= expected_right actual_right))))) - (|> (/.result (/.function (all //.and /.any /.any) /.any) - (type.variant (list expected_left expected_middle expected_right))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_function error)))))) - (_.cover [/.applied /.not_application] - (and (|> (/.result (/.applied (all //.and /.any /.any /.any)) - (type.application (list expected_middle expected_right) expected_left)) + [(_.coverage [<parser> <exception>] + (and (|> (/.result (<parser> (all //.and /.any /.any /.any)) + (<good_constructor> (list expected_left expected_middle expected_right))) (!expect (^.multi {try.#Success [actual_left actual_middle actual_right]} (and (type#= expected_left actual_left) (type#= expected_middle actual_middle) (type#= expected_right actual_right))))) - (|> (/.result (/.applied (all //.and /.any /.any /.any)) - (type.variant (list expected_left expected_middle expected_right))) + (|> (/.result (<parser> (all //.and /.any /.any /.any)) + (<bad_constructor> (list expected_left expected_middle expected_right))) (!expect (^.multi {try.#Failure error} - (exception.match? /.not_application error)))))) + (exception.match? <exception> error))))))] + + [/.variant /.not_variant type.variant type.tuple] + [/.tuple /.not_tuple type.tuple type.variant] + )) + + (_.coverage [/.function /.not_function] + (and (|> (/.result (/.function (all //.and /.any /.any) /.any) + (type.function (list expected_left expected_middle) expected_right)) + (!expect (^.multi {try.#Success [[actual_left actual_middle] actual_right]} + (and (type#= expected_left actual_left) + (type#= expected_middle actual_middle) + (type#= expected_right actual_right))))) + (|> (/.result (/.function (all //.and /.any /.any) /.any) + (type.variant (list expected_left expected_middle expected_right))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_function error)))))) + (_.coverage [/.applied /.not_application] + (and (|> (/.result (/.applied (all //.and /.any /.any /.any)) + (type.application (list expected_middle expected_right) expected_left)) + (!expect (^.multi {try.#Success [actual_left actual_middle actual_right]} + (and (type#= expected_left actual_left) + (type#= expected_middle actual_middle) + (type#= expected_right actual_right))))) + (|> (/.result (/.applied (all //.and /.any /.any /.any)) + (type.variant (list expected_left expected_middle expected_right))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_application error)))))) )))) (def: test|parameter @@ -131,57 +131,57 @@ not_parameter ..primitive parameter random.nat] (all _.and - (_.cover [/.not_parameter] - (|> (/.result /.parameter not_parameter) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_parameter error))))) - (_.cover [/.unknown_parameter] - (|> (/.result /.parameter {.#Parameter parameter}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unknown_parameter error))))) - (_.cover [/.with_extension] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - /.any) - not_parameter) - (!expect (^.multi {try.#Success [quantification##binding argument##binding actual]} - (same? not_parameter actual))))) - (_.cover [/.parameter] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - /.parameter) - {.#Parameter 0}) - (!expect {try.#Success [quantification##binding argument##binding _]}))) - (_.cover [/.argument] - (let [argument? (is (-> Nat Nat Bit) - (function (_ @ expected) - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - (/.with_extension quantification) - (/.with_extension argument) - (do //.monad - [env /.env - _ /.any] - (in (/.argument env @)))) - not_parameter) - (!expect (^.multi {try.#Success [_ _ _ _ actual]} - (n.= expected actual))))))] - (and (argument? 0 2) - (argument? 1 3) - (argument? 2 0)))) - (_.cover [/.wrong_parameter] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - (/.this_parameter 1)) - {.#Parameter 0}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.wrong_parameter error))))) - (_.cover [/.this_parameter] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - (/.this_parameter 0)) - {.#Parameter 0}) - (!expect {try.#Success [quantification##binding argument##binding _]}))) + (_.coverage [/.not_parameter] + (|> (/.result /.parameter not_parameter) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_parameter error))))) + (_.coverage [/.unknown_parameter] + (|> (/.result /.parameter {.#Parameter parameter}) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unknown_parameter error))))) + (_.coverage [/.with_extension] + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + /.any) + not_parameter) + (!expect (^.multi {try.#Success [quantification##binding argument##binding actual]} + (same? not_parameter actual))))) + (_.coverage [/.parameter] + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + /.parameter) + {.#Parameter 0}) + (!expect {try.#Success [quantification##binding argument##binding _]}))) + (_.coverage [/.argument] + (let [argument? (is (-> Nat Nat Bit) + (function (_ @ expected) + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + (/.with_extension quantification) + (/.with_extension argument) + (do //.monad + [env /.env + _ /.any] + (in (/.argument env @)))) + not_parameter) + (!expect (^.multi {try.#Success [_ _ _ _ actual]} + (n.= expected actual))))))] + (and (argument? 0 2) + (argument? 1 3) + (argument? 2 0)))) + (_.coverage [/.wrong_parameter] + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + (/.this_parameter 1)) + {.#Parameter 0}) + (!expect (^.multi {try.#Failure error} + (exception.match? /.wrong_parameter error))))) + (_.coverage [/.this_parameter] + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + (/.this_parameter 0)) + {.#Parameter 0}) + (!expect {try.#Success [quantification##binding argument##binding _]}))) ))) (def: test|polymorphic @@ -190,21 +190,21 @@ [not_polymorphic ..primitive expected_inputs (# ! each (|>> (n.% 10) ++) random.nat)] (all _.and - (_.cover [/.not_polymorphic] - (and (|> (/.result (/.polymorphic /.any) - not_polymorphic) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_polymorphic error)))) - (|> (/.result (/.polymorphic /.any) - (type.univ_q 0 not_polymorphic)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_polymorphic error)))))) - (_.cover [/.polymorphic] - (|> (/.result (/.polymorphic /.any) - (type.univ_q expected_inputs not_polymorphic)) - (!expect (^.multi {try.#Success [g!poly actual_inputs bodyT]} - (and (n.= expected_inputs (list.size actual_inputs)) - (same? not_polymorphic bodyT)))))) + (_.coverage [/.not_polymorphic] + (and (|> (/.result (/.polymorphic /.any) + not_polymorphic) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_polymorphic error)))) + (|> (/.result (/.polymorphic /.any) + (type.univ_q 0 not_polymorphic)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_polymorphic error)))))) + (_.coverage [/.polymorphic] + (|> (/.result (/.polymorphic /.any) + (type.univ_q expected_inputs not_polymorphic)) + (!expect (^.multi {try.#Success [g!poly actual_inputs bodyT]} + (and (n.= expected_inputs (list.size actual_inputs)) + (same? not_polymorphic bodyT)))))) ))) (def: test|recursive @@ -212,29 +212,29 @@ (do random.monad [expected ..primitive] (all _.and - (_.cover [/.recursive] - (|> (.type (Rec @ expected)) - (/.result (/.recursive /.any)) - (!expect (^.multi {try.#Success [@self actual]} - (type#= expected actual))))) - (_.cover [/.recursive_self] - (|> (.type (Rec @ @)) - (/.result (/.recursive /.recursive_self)) - (!expect (^.multi {try.#Success [@expected @actual]} - (same? @expected @actual))))) - (_.cover [/.recursive_call] - (|> (.type (All (self input) (self input))) - (/.result (/.polymorphic /.recursive_call)) - (!expect {try.#Success [@self inputs ???]}))) - (_.cover [/.not_recursive] - (and (|> expected - (/.result (/.recursive /.any)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_recursive error)))) - (|> expected - (/.result /.recursive_self) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_recursive error)))))) + (_.coverage [/.recursive] + (|> (.type (Rec @ expected)) + (/.result (/.recursive /.any)) + (!expect (^.multi {try.#Success [@self actual]} + (type#= expected actual))))) + (_.coverage [/.recursive_self] + (|> (.type (Rec @ @)) + (/.result (/.recursive /.recursive_self)) + (!expect (^.multi {try.#Success [@expected @actual]} + (same? @expected @actual))))) + (_.coverage [/.recursive_call] + (|> (.type (All (self input) (self input))) + (/.result (/.polymorphic /.recursive_call)) + (!expect {try.#Success [@self inputs ???]}))) + (_.coverage [/.not_recursive] + (and (|> expected + (/.result (/.recursive /.any)) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_recursive error)))) + (|> expected + (/.result /.recursive_self) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_recursive error)))))) ))) (def: .public test @@ -244,76 +244,76 @@ (all _.and (do [! random.monad] [expected ..primitive] - (_.cover [/.result /.any] - (|> (/.result /.any expected) - (!expect (^.multi {try.#Success actual} - (type#= expected actual)))))) + (_.coverage [/.result /.any] + (|> (/.result /.any expected) + (!expect (^.multi {try.#Success actual} + (type#= expected actual)))))) (do [! random.monad] [expected ..primitive] - (_.cover [/.next /.unconsumed_input] - (and (|> (/.result (do //.monad - [actual /.next - _ /.any] - (in actual)) - expected) - (!expect (^.multi {try.#Success actual} - (type#= expected actual)))) - (|> (/.result /.next expected) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unconsumed_input error))))))) + (_.coverage [/.next /.unconsumed_input] + (and (|> (/.result (do //.monad + [actual /.next + _ /.any] + (in actual)) + expected) + (!expect (^.multi {try.#Success actual} + (type#= expected actual)))) + (|> (/.result /.next expected) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error))))))) (do [! random.monad] [expected ..primitive] - (_.cover [/.empty_input] - (`` (and (~~ (template [<parser>] - [(|> (/.result (do //.monad - [_ /.any] - <parser>) - expected) - (!expect (^.multi {try.#Failure error} - (exception.match? /.empty_input error))))] + (_.coverage [/.empty_input] + (`` (and (~~ (template [<parser>] + [(|> (/.result (do //.monad + [_ /.any] + <parser>) + expected) + (!expect (^.multi {try.#Failure error} + (exception.match? /.empty_input error))))] - [/.any] - [/.next] - )))))) + [/.any] + [/.next] + )))))) (do [! random.monad] [expected ..primitive] - (_.cover [/.Env /.env /.fresh] - (|> (/.result (do //.monad - [env /.env - _ /.any] - (in env)) - expected) - (!expect (^.multi {try.#Success environment} - (same? /.fresh environment)))))) + (_.coverage [/.Env /.env /.fresh] + (|> (/.result (do //.monad + [env /.env + _ /.any] + (in env)) + expected) + (!expect (^.multi {try.#Success environment} + (same? /.fresh environment)))))) (do [! random.monad] [expected ..primitive dummy (random.only (|>> (type#= expected) not) ..primitive)] - (_.cover [/.local] - (|> (/.result (do //.monad - [_ /.any] - (/.local (list expected) - /.any)) - dummy) - (!expect (^.multi {try.#Success actual} - (type#= expected actual)))))) + (_.coverage [/.local] + (|> (/.result (do //.monad + [_ /.any] + (/.local (list expected) + /.any)) + dummy) + (!expect (^.multi {try.#Success actual} + (type#= expected actual)))))) (do [! random.monad] [expected random.nat] - (_.cover [/.existential /.not_existential] - (|> (/.result /.existential - {.#Ex expected}) - (!expect (^.multi {try.#Success actual} - (n.= expected actual)))))) + (_.coverage [/.existential /.not_existential] + (|> (/.result /.existential + {.#Ex expected}) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))))) (do [! random.monad] [expected_name (random.and (random.alpha_numeric 1) (random.alpha_numeric 1)) expected_type ..primitive] - (_.cover [/.named /.not_named] - (|> (/.result /.named - {.#Named expected_name expected_type}) - (!expect (^.multi {try.#Success [actual_name actual_type]} - (and (symbol#= expected_name actual_name) - (type#= expected_type actual_type))))))) + (_.coverage [/.named /.not_named] + (|> (/.result /.named + {.#Named expected_name expected_type}) + (!expect (^.multi {try.#Success [actual_name actual_type]} + (and (symbol#= expected_name actual_name) + (type#= expected_type actual_type))))))) ..test|aggregate ..test|matches ..test|parameter diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index 10f8acc14..f3e19d428 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -40,13 +40,13 @@ [(with_expansions [<<cases>> (template.spliced <cases>)] (do [! random.monad] [expected (random.alphabetic 1)] - (_.cover [<exception>] - (`` (and (~~ (template [<parser> <input>] - [(|> (/.result <parser> (list <input>)) - (!expect (^.multi {try.#Failure error} - (exception.match? <exception> error))))] + (_.coverage [<exception>] + (`` (and (~~ (template [<parser> <input>] + [(|> (/.result <parser> (list <input>)) + (!expect (^.multi {try.#Failure error} + (exception.match? <exception> error))))] - <<cases>>)))))))]) + <<cases>>)))))))]) (def: random_label (Random Symbol) @@ -63,34 +63,34 @@ (all _.and (do [! random.monad] [expected (random.alphabetic 1)] - (_.cover [/.result /.text] - (|> (/.result /.text (list {xml.#Text expected})) - (!expect (^.multi {try.#Success actual} - (text#= expected actual)))))) + (_.coverage [/.result /.text] + (|> (/.result /.text (list {xml.#Text expected})) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))))) (!failure /.unconsumed_inputs [[(//#in expected) {xml.#Text expected}]]) (do [! random.monad] [expected (# ! each (|>> {xml.#Text}) (random.alphabetic 1))] - (_.cover [/.any] - (|> (/.result /.any (list expected)) - (try#each (xml#= expected)) - (try.else false)))) + (_.coverage [/.any] + (|> (/.result /.any (list expected)) + (try#each (xml#= expected)) + (try.else false)))) (do [! random.monad] [expected ..random_tag] - (_.cover [/.tag] - (|> (/.result (do //.monad - [actual /.tag - _ /.any] - (in (symbol#= expected actual))) - (list {xml.#Node expected (dictionary.empty symbol.hash) (list)})) - (!expect {try.#Success #1})))) + (_.coverage [/.tag] + (|> (/.result (do //.monad + [actual /.tag + _ /.any] + (in (symbol#= expected actual))) + (list {xml.#Node expected (dictionary.empty symbol.hash) (list)})) + (!expect {try.#Success #1})))) (do [! random.monad] [expected ..random_tag] - (_.cover [/.node] - (|> (/.result (/.node expected (//#in [])) - (list {xml.#Node expected (dictionary.empty symbol.hash) (list)})) - (!expect {try.#Success []})))) + (_.coverage [/.node] + (|> (/.result (/.node expected (//#in [])) + (list {xml.#Node expected (dictionary.empty symbol.hash) (list)})) + (!expect {try.#Success []})))) (!failure /.wrong_tag [[(/.node ["" expected] (//#in [])) {xml.#Node [expected ""] (dictionary.empty symbol.hash) (list)}]]) @@ -98,15 +98,15 @@ [expected_tag ..random_tag expected_attribute ..random_attribute expected_value (random.alphabetic 1)] - (_.cover [/.attribute] - (|> (/.result (<| (/.node expected_tag) - (//.after (/.attribute expected_attribute)) - (//#in [])) - (list {xml.#Node expected_tag - (|> (dictionary.empty symbol.hash) - (dictionary.has expected_attribute expected_value)) - (list)})) - (!expect {try.#Success []})))) + (_.coverage [/.attribute] + (|> (/.result (<| (/.node expected_tag) + (//.after (/.attribute expected_attribute)) + (//#in [])) + (list {xml.#Node expected_tag + (|> (dictionary.empty symbol.hash) + (dictionary.has expected_attribute expected_value)) + (list)})) + (!expect {try.#Success []})))) (!failure /.unknown_attribute [[(/.attribute ["" expected]) {xml.#Node [expected expected] @@ -163,18 +163,18 @@ (in [])))] repetitions (# ! each (n.% 10) random.nat)] (all _.and - (_.cover [/.somewhere] - (|> (/.result parser - (list (node parent - (list.together (list (list.repeated repetitions (node wrong (list))) - (list (node right (list))) - (list.repeated repetitions (node wrong (list)))))))) - (!expect {try.#Success []}))) - (_.cover [/.nowhere] - (|> (/.result parser - (list (node parent - (list.repeated repetitions (node wrong (list)))))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.nowhere error))))) + (_.coverage [/.somewhere] + (|> (/.result parser + (list (node parent + (list.together (list (list.repeated repetitions (node wrong (list))) + (list (node right (list))) + (list.repeated repetitions (node wrong (list)))))))) + (!expect {try.#Success []}))) + (_.coverage [/.nowhere] + (|> (/.result parser + (list (node parent + (list.repeated repetitions (node wrong (list)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.nowhere error))))) )) ))) |