aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/time/instant.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/time/instant.lux')
-rw-r--r--stdlib/source/test/lux/time/instant.lux98
1 files changed, 49 insertions, 49 deletions
diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux
index 16299a1a4..b31bf3749 100644
--- a/stdlib/source/test/lux/time/instant.lux
+++ b/stdlib/source/test/lux/time/instant.lux
@@ -42,14 +42,14 @@
[.let [(open "#[0]") /.equivalence]
expected random.instant]
(all _.and
- (_.cover [/.millis /.of_millis]
- (|> expected /.millis /.of_millis (#= expected)))
- (_.cover [/.relative /.absolute]
- (|> expected /.relative /.absolute (#= expected)))
- (_.cover [/.date /.time /.of_date_time]
- (#= expected
- (/.of_date_time (/.date expected)
- (/.time expected))))
+ (_.coverage [/.millis /.of_millis]
+ (|> expected /.millis /.of_millis (#= expected)))
+ (_.coverage [/.relative /.absolute]
+ (|> expected /.relative /.absolute (#= expected)))
+ (_.coverage [/.date /.time /.of_date_time]
+ (#= expected
+ (/.of_date_time (/.date expected)
+ (/.time expected))))
))
(do random.monad
[.let [(open "#[0]") /.equivalence
@@ -57,50 +57,50 @@
from random.instant
to random.instant]
(all _.and
- (_.cover [/.span]
- (|> from (/.span from) (duration#= duration.empty)))
- (_.cover [/.after]
- (|> from (/.after (/.span from to)) (#= to)))
- (_.cover [/.epoch]
- (duration#= (/.relative to)
- (/.span /.epoch to)))
+ (_.coverage [/.span]
+ (|> from (/.span from) (duration#= duration.empty)))
+ (_.coverage [/.after]
+ (|> from (/.after (/.span from to)) (#= to)))
+ (_.coverage [/.epoch]
+ (duration#= (/.relative to)
+ (/.span /.epoch to)))
))
(do random.monad
[instant random.instant
.let [d0 (/.day_of_week instant)]]
- (_.cover [/.day_of_week]
- (let [apply (is (-> (-> Duration Duration) (-> Day Day) Nat Bit)
- (function (_ polarity move steps)
- (let [day_shift (list#mix (function.constant move)
- d0
- (list.repeated steps []))
- instant_shift (|> instant
- (/.after (polarity (duration.up steps duration.day)))
- /.day_of_week)]
- (day#= day_shift
- instant_shift))))]
- (and (apply function.identity day#succ 0)
- (apply function.identity day#succ 1)
- (apply function.identity day#succ 2)
- (apply function.identity day#succ 3)
- (apply function.identity day#succ 4)
- (apply function.identity day#succ 5)
- (apply function.identity day#succ 6)
- (apply function.identity day#succ 7)
+ (_.coverage [/.day_of_week]
+ (let [apply (is (-> (-> Duration Duration) (-> Day Day) Nat Bit)
+ (function (_ polarity move steps)
+ (let [day_shift (list#mix (function.constant move)
+ d0
+ (list.repeated steps []))
+ instant_shift (|> instant
+ (/.after (polarity (duration.up steps duration.day)))
+ /.day_of_week)]
+ (day#= day_shift
+ instant_shift))))]
+ (and (apply function.identity day#succ 0)
+ (apply function.identity day#succ 1)
+ (apply function.identity day#succ 2)
+ (apply function.identity day#succ 3)
+ (apply function.identity day#succ 4)
+ (apply function.identity day#succ 5)
+ (apply function.identity day#succ 6)
+ (apply function.identity day#succ 7)
- (apply duration.inverse day#pred 0)
- (apply duration.inverse day#pred 1)
- (apply duration.inverse day#pred 2)
- (apply duration.inverse day#pred 3)
- (apply duration.inverse day#pred 4)
- (apply duration.inverse day#pred 5)
- (apply duration.inverse day#pred 6)
- (apply duration.inverse day#pred 7)))))
- (_.cover [/.now]
- (case (try (io.run! /.now))
- {try.#Success _}
- true
-
- {try.#Failure _}
- false))
+ (apply duration.inverse day#pred 0)
+ (apply duration.inverse day#pred 1)
+ (apply duration.inverse day#pred 2)
+ (apply duration.inverse day#pred 3)
+ (apply duration.inverse day#pred 4)
+ (apply duration.inverse day#pred 5)
+ (apply duration.inverse day#pred 6)
+ (apply duration.inverse day#pred 7)))))
+ (_.coverage [/.now]
+ (case (try (io.run! /.now))
+ {try.#Success _}
+ true
+
+ {try.#Failure _}
+ false))
)))