aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/test.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/test.lux')
-rw-r--r--stdlib/source/lux/test.lux24
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux
index 6d21a074b..e25f685cf 100644
--- a/stdlib/source/lux/test.lux
+++ b/stdlib/source/lux/test.lux
@@ -11,11 +11,11 @@
[maybe]
[text]
text/format
- ["E" result])
+ ["E" error])
[io #- run]
(time [instant]
[duration])
- ["R" math/random]))
+ ["r" math/random]))
## [Host]
(do-template [<name> <signal>]
@@ -83,18 +83,18 @@
(|>. product;right (n.> +0)))
(def: (try seed random-test)
- (-> Seed (R;Random Test) (Promise [Seed [Counters Text]]))
- (let [[prng [new-seed test]] (R;run (R;pcg-32 [pcg-32-magic-inc seed])
- (do R;Monad<Random>
+ (-> Seed (r;Random Test) (Promise [Seed [Counters Text]]))
+ (let [[prng [new-seed test]] (r;run (r;pcg-32 [pcg-32-magic-inc seed])
+ (do r;Monad<Random>
[test random-test
- next-seed R;nat]
+ next-seed r;nat]
(wrap [next-seed test])))]
(do Monad<Promise>
[result test]
(wrap [new-seed result]))))
(def: (repeat' seed times random-test)
- (-> Seed Nat (R;Random Test) Test)
+ (-> Seed Nat (r;Random Test) Test)
(if (n.= +0 times)
(fail "Cannot try a test 0 times.")
(do Monad<Promise>
@@ -110,9 +110,9 @@
(repeat' seed' (n.dec times) random-test)))))
(def: #hidden (repeat ?seed times random-test)
- (-> (Maybe Nat) Nat (R;Random Test) Test)
+ (-> (Maybe Nat) Nat (r;Random Test) Test)
(repeat' (maybe;default (|> (io;run instant;now) instant;to-millis int-to-nat)
- ?seed)
+ ?seed)
(case ?seed
#;None times
(#;Some _) +1)
@@ -197,10 +197,10 @@
(test "Can have defaults for Maybe values."
(and (is "yolo" (maybe;default "yolo"
- #;None))
+ #;None))
(is "lol" (maybe;default "yolo"
- (#;Some "lol")))))
+ (#;Some "lol")))))
))
"Also works with random generation of values for property-based testing."
(context: "Addition & Substraction"
@@ -240,7 +240,7 @@
bindings' (|> bindings (L/map pair-to-list) L/join)]
(` (repeat (~ =seed)
(~ (code;nat =times))
- (do R;Monad<Random>
+ (do r;Monad<Random>
[(~@ bindings')]
((~' wrap) (;;try-body (io;io (~ body))))))))