diff options
Diffstat (limited to 'stdlib/source/test/lux/time/date.lux')
-rw-r--r-- | stdlib/source/test/lux/time/date.lux | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index ceabc66f1..e24194825 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -1,96 +1,96 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] - [control - ["[0]" try ("[1]#[0]" functor)] - ["[0]" exception] - [parser - ["<[0]>" text]]] - [data - [text - ["%" format {"+" format}]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["i" int]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" enum] + ["$[0]" codec]]] + [control + ["[0]" try ("[1]#[0]" functor)] + ["[0]" exception] + [parser + ["<[0]>" text]]] + [data + [text + ["%" format {"+" format}]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["i" int]]]]] + [\\library + ["[0]" /]]) (def: .public test Test (<| (_.covering /._) (_.for [/.Date]) - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence random.date)) - (_.for [/.order] - ($order.spec /.order random.date)) - (_.for [/.enum] - ($enum.spec /.enum random.date)) - (_.for [/.codec] - ($codec.spec /.equivalence /.codec random.date)) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence random.date)) + (_.for [/.order] + ($order.spec /.order random.date)) + (_.for [/.enum] + ($enum.spec /.enum random.date)) + (_.for [/.codec] + ($codec.spec /.equivalence /.codec random.date)) - (do random.monad - [expected random.date] - (_.cover [/.date /.year /.month /.day_of_month] - (|> (/.date (/.year expected) - (/.month expected) - (/.day_of_month expected)) - (try#each (# /.equivalence = expected)) - (try.else false)))) - (do random.monad - [expected random.date] - (_.cover [/.invalid_day] - (case (/.date (/.year expected) - (/.month expected) - (n.+ 31 (/.day_of_month expected))) - {try.#Failure error} - (exception.match? /.invalid_day error) - - {try.#Success _} - false))) - (do random.monad - [expected random.date] - (_.cover [/.days /.of_days] - (|> expected - /.days - /.of_days - (# /.equivalence = expected)))) - (_.cover [/.epoch] - (|> /.epoch - /.days - (i.= +0))) - (do random.monad - [expected random.date] - (_.cover [/.parser] - (|> (# /.codec encoded expected) - (<text>.result /.parser) - (try#each (# /.equivalence = expected)) - (try.else false)))) - (do [! random.monad] - [year (# ! each (|>> (n.% 10,000) ++) - random.nat) - month (# ! each (|>> (n.% 10) (n.+ 13)) + (do random.monad + [expected random.date] + (_.cover [/.date /.year /.month /.day_of_month] + (|> (/.date (/.year expected) + (/.month expected) + (/.day_of_month expected)) + (try#each (# /.equivalence = expected)) + (try.else false)))) + (do random.monad + [expected random.date] + (_.cover [/.invalid_day] + (case (/.date (/.year expected) + (/.month expected) + (n.+ 31 (/.day_of_month expected))) + {try.#Failure error} + (exception.match? /.invalid_day error) + + {try.#Success _} + false))) + (do random.monad + [expected random.date] + (_.cover [/.days /.of_days] + (|> expected + /.days + /.of_days + (# /.equivalence = expected)))) + (_.cover [/.epoch] + (|> /.epoch + /.days + (i.= +0))) + (do random.monad + [expected random.date] + (_.cover [/.parser] + (|> (# /.codec encoded expected) + (<text>.result /.parser) + (try#each (# /.equivalence = expected)) + (try.else false)))) + (do [! random.monad] + [year (# ! each (|>> (n.% 10,000) ++) random.nat) - day (# ! each (|>> (n.% 10) (n.+ 10)) - random.nat) - .let [input (format (%.nat year) - "-" (%.nat month) - "-" (%.nat day))]] - (_.cover [/.invalid_month] - (case (<text>.result /.parser input) - {try.#Failure error} - (exception.match? /.invalid_month error) - - {try.#Success _} - false))) - ))) + month (# ! each (|>> (n.% 10) (n.+ 13)) + random.nat) + day (# ! each (|>> (n.% 10) (n.+ 10)) + random.nat) + .let [input (format (%.nat year) + "-" (%.nat month) + "-" (%.nat day))]] + (_.cover [/.invalid_month] + (case (<text>.result /.parser input) + {try.#Failure error} + (exception.match? /.invalid_month error) + + {try.#Success _} + false))) + ))) |