aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/artifact/time
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/aedifex/artifact/time.lux9
-rw-r--r--stdlib/source/test/aedifex/artifact/time/date.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/time/time.lux10
3 files changed, 16 insertions, 5 deletions
diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux
index 4bf63018c..b14032a8c 100644
--- a/stdlib/source/test/aedifex/artifact/time.lux
+++ b/stdlib/source/test/aedifex/artifact/time.lux
@@ -11,7 +11,9 @@
[parser
["<.>" text]]]
[math
- ["." random (#+ Random)]]
+ ["." random (#+ Random)]
+ [number
+ ["i" int]]]
[time
["." instant]]]
{#program
@@ -22,7 +24,10 @@
(def: #export random
(Random /.Time)
- random.instant)
+ (do random.monad
+ [date /date.random
+ time /time.random]
+ (wrap (instant.from_date_time date time))))
(def: #export test
Test
diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux
index 0f4b5b7d3..932d1698e 100644
--- a/stdlib/source/test/aedifex/artifact/time/date.lux
+++ b/stdlib/source/test/aedifex/artifact/time/date.lux
@@ -23,7 +23,7 @@
(random.one (function (_ raw)
(try.to_maybe
(do try.monad
- [year (|> raw date.year year.value i.abs (i.% +10,000) year.year)]
+ [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)))))
diff --git a/stdlib/source/test/aedifex/artifact/time/time.lux b/stdlib/source/test/aedifex/artifact/time/time.lux
index bd9bbe071..cd70d1c83 100644
--- a/stdlib/source/test/aedifex/artifact/time/time.lux
+++ b/stdlib/source/test/aedifex/artifact/time/time.lux
@@ -1,7 +1,7 @@
(.module:
[lux #*
["_" test (#+ Test)]
- ["." time (#+ Time)]
+ ["." time]
[abstract
[monad (#+ do)]]
[control
@@ -16,12 +16,18 @@
{#program
["." /]})
+(def: #export random
+ (Random /.Time)
+ (random.one (|>> time.clock (set@ #time.milli_second 0) time.time)
+ random.time))
+
(def: #export test
Test
(<| (_.covering /._)
+ (_.for [/.Time])
($_ _.and
(do random.monad
- [expected random.time]
+ [expected ..random]
(_.cover [/.format /.parser]
(|> expected
/.format