diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/time.lux | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/stdlib/test/test/lux/time.lux b/stdlib/test/test/lux/time.lux index becdfc068..3d477f4ea 100644 --- a/stdlib/test/test/lux/time.lux +++ b/stdlib/test/test/lux/time.lux @@ -20,23 +20,10 @@ (i.% (nat-to-int size)) (i.* (Int/signum sample)))))) -(def: (pow exp base) - (-> Nat Int Int) - (case exp - +0 1 - _ (loop [exp exp - result base] - (case exp - +1 result - _ (recur (n.dec exp) - (i.* base result)))))) -(def: boundary Int (|> 2 (pow +31) (i.* @;second))) +(def: boundary Int 99_999_999_999_999) (def: time (r;Random @;Time) - (|> r;int - (r;filter (i.>= 0)) - ## (:: r;Monad<Random> map (i.% boundary)) - )) + (|> r;int (:: r;Monad<Random> map (i.% boundary)))) (context: "Equality" [sample time @@ -64,15 +51,11 @@ (and (or (< reference sample) (>= reference sample)) (or (> reference sample) - (<= reference sample)))) - ) + (<= reference sample))))) (context: "Codec" - ## #seed +1484609979608 - ## #seed +1484654273059 + #seed +16366082068080165840 [sample time - ## #let [sample 1095292800_000] - ## #let [_ (log! (format "sample = " (%i sample)))] #let [(^open "&/") @;Codec<Text,Time>]] (test "Can encode/decode times." (|> sample @@ -82,5 +65,4 @@ (@;t.= sample decoded) (#R;Error error) - false))) - ) + false)))) |