diff options
Diffstat (limited to 'stdlib/source/lux/test.lux')
-rw-r--r-- | stdlib/source/lux/test.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 8bb0a71a3..f9ea42c2e 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -33,12 +33,12 @@ (type: #export Test (r.Random (Promise [Counters Text]))) -(def: pcg-32-magic-inc Nat +12345) +(def: pcg-32-magic-inc Nat |12345) ## [Values] -(def: success Counters [+1 +0]) -(def: failure Counters [+0 +1]) -(def: start Counters [+0 +0]) +(def: success Counters [|1 |0]) +(def: failure Counters [|0 |1]) +(def: start Counters [|0 |0]) (def: (add-counters [s f] [ts tf]) (-> Counters Counters Counters) @@ -87,7 +87,7 @@ (def: failed? (-> Counters Bit) - (|>> product.right (n/> +0))) + (|>> product.right (n/> |0))) (def: #export (seed value test) (-> Seed Test Test) @@ -103,10 +103,10 @@ (def: #export (times amount test) (-> Nat Test Test) - (cond (n/= +0 amount) + (cond (n/= |0 amount) (fail "Cannot try a test 0 times.") - (n/= +1 amount) + (n/= |1 amount) test ## else @@ -167,7 +167,7 @@ "By default, random tests will be tried 100 times, you can specify the amount you want:" (context: "Addition & Substraction" - (<| (times +1234) + (<| (times |1234) (do @ [x (:: @ map <prep> rand-gen) y (:: @ map <prep> rand-gen)] @@ -177,7 +177,7 @@ "If a test fails, you'll be shown a seed that you can then use to reproduce a failing scenario." (context: "Addition & Substraction" - (<| (seed +987654321) + (<| (seed |987654321) (do @ [x (:: @ map <prep> rand-gen) y (:: @ map <prep> rand-gen)] @@ -235,8 +235,8 @@ (:: @ map list/join)))] (wrap (list (` (: (~! (IO Any)) ((~! io) (exec ((~! do) (~! promise.Monad<Promise>) - [(~' #let) [(~ g!total-successes) +0 - (~ g!total-failures) +0] + [(~' #let) [(~ g!total-successes) |0 + (~ g!total-failures) |0] (~+ (|> tests (list/map (function (_ [module-name test desc]) (` [(~ (code.text module-name)) (~ (code.identifier [module-name test])) (~ (code.text desc))]))) @@ -248,7 +248,7 @@ list/join))] (exec (log! ((~! success-message) (~ g!total-successes) (~ g!total-failures))) ((~! promise.future) - ((~! io.exit) (if (n/> +0 (~ g!total-failures)) + ((~! io.exit) (if (n/> |0 (~ g!total-failures)) 1 0))))) []))))))))) |