diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/control/parser/json.lux | 144 |
1 files changed, 72 insertions, 72 deletions
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)))))) )))) |