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/snapshot.lux | 8 +++----- stdlib/source/test/aedifex/artifact/snapshot/stamp.lux | 14 ++++++-------- stdlib/source/test/aedifex/artifact/snapshot/time.lux | 12 ++++++------ stdlib/source/test/aedifex/artifact/snapshot/version.lux | 4 ++++ stdlib/source/test/aedifex/artifact/time.lux | 8 +++----- stdlib/source/test/aedifex/artifact/time/date.lux | 16 +++++++++------- stdlib/source/test/aedifex/artifact/versioning.lux | 3 ++- 7 files changed, 33 insertions(+), 32 deletions(-) (limited to 'stdlib/source/test/aedifex/artifact') diff --git a/stdlib/source/test/aedifex/artifact/snapshot.lux b/stdlib/source/test/aedifex/artifact/snapshot.lux index 192978ebf..d48c8f34e 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot.lux @@ -14,10 +14,9 @@ ["." random (#+ Random) ("#\." monad)]]] ["$." / #_ ["#." build] - ["#." time] ["#." stamp] - ["#." version - ["#/." value]]] + ["#." time] + ["#." version]] {#program ["." /]}) @@ -45,8 +44,7 @@ (try.default false)))) $/build.test - $/time.test $/stamp.test + $/time.test $/version.test - $/version/value.test )))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux index a36e5af9d..f2051d037 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux @@ -37,12 +37,10 @@ (do random.monad [expected ..random] - ($_ _.and - (_.cover [/.format /.parser] - (|> expected - /.format - (.run /.parser) - (try\map (\ /.equivalence = expected)) - (try.default false))) - )) + (_.cover [/.format /.parser] + (|> expected + /.format + (.run /.parser) + (try\map (\ /.equivalence = expected)) + (try.default false)))) ))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/time.lux b/stdlib/source/test/aedifex/artifact/snapshot/time.lux index 567c70ce4..3acb37232 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/time.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/time.lux @@ -11,15 +11,15 @@ [parser ["<.>" text]]] [math - ["." random (#+ Random)]] - [time - ["." instant]]] + ["." random (#+ Random)]]] {#program - ["." /]}) + ["." /]} + ["$." /// #_ + ["#." time]]) (def: #export random (Random /.Time) - random.instant) + $///time.random) (def: #export test Test @@ -36,7 +36,7 @@ (|> expected /.format (.run /.parser) - (try\map (\ instant.equivalence = expected)) + (try\map (\ /.equivalence = expected)) (try.default false))) )) ))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version.lux b/stdlib/source/test/aedifex/artifact/snapshot/version.lux index e08691c3c..59ed7189f 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version.lux @@ -14,6 +14,8 @@ ["." random (#+ Random)]]] {#program ["." /]} + ["." / #_ + ["#." value]] ["$." /// #_ ["#." type] ["#." time]]) @@ -43,4 +45,6 @@ (.run /.parser) (try\map (\ /.equivalence = expected)) (try.default false)))) + + /value.test ))) diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux index b14032a8c..b9b0ab4e0 100644 --- a/stdlib/source/test/aedifex/artifact/time.lux +++ b/stdlib/source/test/aedifex/artifact/time.lux @@ -13,9 +13,7 @@ [math ["." random (#+ Random)] [number - ["i" int]]] - [time - ["." instant]]] + ["i" int]]]] {#program ["." /]} ["." / #_ @@ -27,7 +25,7 @@ (do random.monad [date /date.random time /time.random] - (wrap (instant.from_date_time date time)))) + (wrap [date time]))) (def: #export test Test @@ -43,7 +41,7 @@ (|> expected /.format (.run /.parser) - (try\map (\ instant.equivalence = expected)) + (try\map (\ /.equivalence = expected)) (try.default false)))) /date.test 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)))) ))) diff --git a/stdlib/source/test/aedifex/artifact/versioning.lux b/stdlib/source/test/aedifex/artifact/versioning.lux index ab0e94236..c438caca5 100644 --- a/stdlib/source/test/aedifex/artifact/versioning.lux +++ b/stdlib/source/test/aedifex/artifact/versioning.lux @@ -15,6 +15,7 @@ {#program ["." /]} ["$." // #_ + ["#." time] ["#." snapshot ["#/." version]]]) @@ -22,7 +23,7 @@ (Random /.Versioning) ($_ random.and $//snapshot.random - random.instant + $//time.random (random.list 5 $//snapshot/version.random) )) -- cgit v1.2.3