diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/aedifex/hash.lux | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux index 8f6558cb5..804708085 100644 --- a/stdlib/source/test/aedifex/hash.lux +++ b/stdlib/source/test/aedifex/hash.lux @@ -1,29 +1,29 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" codec]]] - [control - ["[0]" try] - ["[0]" exception]] - [data - ["[0]" binary {"+" Binary}] - [text - ["%" format {"+" format}]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\program - ["[0]" /]] - [test - [lux - [data - ["_[0]" binary]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" codec]]] + [control + ["[0]" try] + ["[0]" exception]] + [data + ["[0]" binary {"+" Binary}] + [text + ["%" format {"+" format}]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\program + ["[0]" /]] + [test + [lux + [data + ["_[0]" binary]]]]) (def: .public (random hash) (All (_ h) @@ -37,59 +37,59 @@ Test (<| (_.covering /._) (_.for [/.Hash /.SHA-1 /.MD5]) - (`` ($_ _.and - (_.for [/.equivalence] - ($_ _.and - ($equivalence.spec /.equivalence (..random /.sha-1)) - ($equivalence.spec /.equivalence (..random /.md5)) - )) - (_.for [/.data] - ($_ _.and - (~~ (template [<hash> <constructor> <exception>] - [(do random.monad - [expected (..random <hash>)] - (_.cover [<hash> <constructor> <exception>] - (and (case (<constructor> (/.data expected)) - {try.#Success actual} - (# /.equivalence = expected actual) + (`` (all _.and + (_.for [/.equivalence] + (all _.and + ($equivalence.spec /.equivalence (..random /.sha-1)) + ($equivalence.spec /.equivalence (..random /.md5)) + )) + (_.for [/.data] + (all _.and + (~~ (template [<hash> <constructor> <exception>] + [(do random.monad + [expected (..random <hash>)] + (_.cover [<hash> <constructor> <exception>] + (and (case (<constructor> (/.data expected)) + {try.#Success actual} + (# /.equivalence = expected actual) - {try.#Failure error} - false) - (case (<constructor> (# binary.monoid composite - (/.data expected) - (/.data expected))) - {try.#Success actual} - false + {try.#Failure error} + false) + (case (<constructor> (# binary.monoid composite + (/.data expected) + (/.data expected))) + {try.#Success actual} + false - {try.#Failure error} - (exception.match? <exception> error)))))] + {try.#Failure error} + (exception.match? <exception> error)))))] - [/.sha-1 /.as_sha-1 /.not_a_sha-1] - [/.md5 /.as_md5 /.not_a_md5] - )))) - (~~ (template [<codec> <hash>] - [(_.for [<codec>] - ($codec.spec /.equivalence <codec> (..random <hash>)))] - - [/.sha-1_codec /.sha-1] - [/.md5_codec /.md5] - )) - (_.for [/.not_a_hash] - ($_ _.and - (~~ (template [<codec> <hash>] - [(do random.monad - [expected (..random <hash>)] - (_.cover [<codec>] - (case (# <codec> decoded - (format (# <codec> encoded expected) - "AABBCC")) - {try.#Success actual} - false + [/.sha-1 /.as_sha-1 /.not_a_sha-1] + [/.md5 /.as_md5 /.not_a_md5] + )))) + (~~ (template [<codec> <hash>] + [(_.for [<codec>] + ($codec.spec /.equivalence <codec> (..random <hash>)))] + + [/.sha-1_codec /.sha-1] + [/.md5_codec /.md5] + )) + (_.for [/.not_a_hash] + (all _.and + (~~ (template [<codec> <hash>] + [(do random.monad + [expected (..random <hash>)] + (_.cover [<codec>] + (case (# <codec> decoded + (format (# <codec> encoded expected) + "AABBCC")) + {try.#Success actual} + false - {try.#Failure error} - (exception.match? /.not_a_hash error))))] + {try.#Failure error} + (exception.match? /.not_a_hash error))))] - [/.sha-1_codec /.sha-1] - [/.md5_codec /.md5] - )))) - )))) + [/.sha-1_codec /.sha-1] + [/.md5_codec /.md5] + )))) + )))) |