From af3e6e2cb011dc2ad9204440990731a2f272716d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 12 Jun 2021 01:32:40 -0400 Subject: Constraining the year of the snapshot time in Aedifex. --- stdlib/source/test/aedifex/artifact/time/date.lux | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'stdlib/source/test/aedifex/artifact/time') diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index 932d1698e..a68a60a56 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -13,25 +13,27 @@ ["n" nat] ["i" int]]] [time - ["." date (#+ Date)] + ["." date] ["." year]]] {#program ["." /]}) (def: #export random - (Random Date) + (Random /.Date) (random.one (function (_ raw) (try.to_maybe (do try.monad - [year (|> raw date.year year.value i.abs (i.% +9,000) (i.+ +1,000) year.year)] - (date.date year - (date.month raw) - (date.day_of_month raw))))) + [year (|> raw date.year year.value i.abs (i.% +9,000) (i.+ +1,000) year.year) + raw (date.date year + (date.month raw) + (date.day_of_month raw))] + (/.date raw)))) random.date)) (def: #export test Test (<| (_.covering /._) + (_.for [/.Date]) ($_ _.and (do random.monad [expected ..random] @@ -39,6 +41,6 @@ (|> expected /.format (.run /.parser) - (try\map (\ date.equivalence = expected)) + (try\map (\ /.equivalence = expected)) (try.default false)))) ))) -- cgit v1.2.3