diff options
Diffstat (limited to 'stdlib/source/test')
-rw-r--r-- | stdlib/source/test/lux/macro/poly/json.lux | 1 | ||||
-rw-r--r-- | stdlib/source/test/lux/time/date.lux | 10 | ||||
-rw-r--r-- | stdlib/source/test/lux/time/duration.lux | 15 | ||||
-rw-r--r-- | stdlib/source/test/lux/time/instant.lux | 17 |
4 files changed, 22 insertions, 21 deletions
diff --git a/stdlib/source/test/lux/macro/poly/json.lux b/stdlib/source/test/lux/macro/poly/json.lux index 55b2d2dd2..144994f50 100644 --- a/stdlib/source/test/lux/macro/poly/json.lux +++ b/stdlib/source/test/lux/macro/poly/json.lux @@ -13,6 +13,7 @@ ["$." codec]]}] [control pipe + ["." try] ["p" parser ## TODO: Get rid of this import ASAP [json (#+)]]] diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index 6ca543cf9..fd17f3075 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -1,15 +1,18 @@ (.module: [lux #* ["%" data/text/format (#+ format)] - ["r" math/random (#+ Random)] ["_" test (#+ Test)] + [math + ["." random (#+ Random)]] [abstract ["." monad (#+ do)] {[0 #spec] [/ ["$." equivalence] ["$." order] - ["$." codec]]}]] + ["$." codec]]}] + [control + ["." try]]] [// ["_." instant]] {1 @@ -19,7 +22,8 @@ (def: #export date (Random Date) - (|> _instant.instant (:: r.monad map //instant.date))) + (:: random.monad map //instant.date + _instant.instant)) (def: #export test Test diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index a08019366..5900f1958 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -15,13 +15,13 @@ ["n" nat] ["i" int]]] [math - ["r" random (#+ Random)]]] + ["." random (#+ Random)]]] {1 ["." / (#+ Duration)]}) (def: #export duration (Random Duration) - (|> r.int (:: r.monad map /.from-millis))) + (:: random.monad map /.from-millis random.int)) (def: #export test Test @@ -30,17 +30,16 @@ ($equivalence.spec /.equivalence ..duration) ($order.spec /.order ..duration) ($monoid.spec /.equivalence /.monoid ..duration) - ## TODO; Uncomment ASAP - ## ($codec.spec /.equivalence /.codec ..duration) + ($codec.spec /.equivalence /.codec ..duration) - (do r.monad - [millis r.int] + (do random.monad + [millis random.int] (_.test "Can convert from/to milliseconds." (|> millis /.from-millis /.to-millis (i.= millis)))) - (do {@ r.monad} + (do {@ random.monad} [sample (|> duration (:: @ map (/.frame /.day))) frame duration - factor (|> r.nat (:: @ map (|>> (n.% 10) (n.max 1)))) + factor (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1)))) #let [(^open "/@.") /.order]] ($_ _.and (_.test "Can scale a duration." diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index f2e44cead..3849c7b67 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -11,13 +11,13 @@ ["$." enum] ["$." codec]]}] [control - pipe] + ["." try]] [data ["." text] [number ["i" int]]] [math - ["r" random (#+ Random)]] + ["." random (#+ Random)]] [time ["@d" duration] ["@date" date]]] @@ -26,11 +26,9 @@ {1 ["." / (#+ Instant)]}) -(def: boundary Int +99,999,999,999,999) - (def: #export instant (Random Instant) - (:: r.monad map (|>> (i.% boundary) /.from-millis) r.int)) + (:: random.monad map /.from-millis random.int)) (def: #export test Test @@ -39,14 +37,13 @@ ($equivalence.spec /.equivalence ..instant) ($order.spec /.order ..instant) ($enum.spec /.enum ..instant) - ## TODO; Uncomment ASAP - ## ($codec.spec /.equivalence /.codec ..instant) + ($codec.spec /.equivalence /.codec ..instant) - (do r.monad - [millis r.int] + (do random.monad + [millis random.int] (_.test "Can convert from/to milliseconds." (|> millis /.from-millis /.to-millis (i.= millis)))) - (do r.monad + (do random.monad [sample instant span _duration.duration #let [(^open "@/.") /.equivalence |