diff options
author | Eduardo Julian | 2022-07-28 17:39:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-07-28 17:39:01 -0400 |
commit | a4b64bf1cdf47160b6b615d2c6493039abfd7a94 (patch) | |
tree | 3fe8c149d9cad89bbf067c736d196260203d1a01 /stdlib/source/test/lux/control/concurrency/async.lux | |
parent | a4847190df926d35f7ece97da50a2a8b1462a24f (diff) |
Extracted unit-testing machinery into its own module.
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/async.lux')
-rw-r--r-- | stdlib/source/test/lux/control/concurrency/async.lux | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 42d938ddd..3cdaf2da4 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -21,7 +20,9 @@ [world [time ["[0]" instant] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -73,22 +74,22 @@ (/.async []))] resolved? (/.future (resolver expected)) actual async] - (_.coverage' [/.Async /.Resolver /.async] + (unit.coverage [/.Async /.Resolver /.async] (and resolved? (n.= expected actual))))) (in (do /.monad [actual (/.resolved expected)] - (_.coverage' [/.resolved] + (unit.coverage [/.resolved] (n.= expected actual)))) (in (do /.monad [actual (/.future (io.io expected))] - (_.coverage' [/.future] + (unit.coverage [/.future] (n.= expected actual)))) (in (do /.monad [pre (/.future instant.now) actual (/.schedule! waiting_time (io.io expected)) post (/.future instant.now)] - (_.coverage' [/.schedule!] + (unit.coverage [/.schedule!] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) @@ -96,20 +97,20 @@ [pre (/.future instant.now) _ (/.delay waiting_time) post (/.future instant.now)] - (_.coverage' [/.delay] + (unit.coverage [/.delay] (i.>= (.int waiting_time) (duration.millis (instant.span pre post)))))) (in (do /.monad [[leftA rightA] (/.and (/.future (io.io leftE)) (/.future (io.io rightE)))] - (_.coverage' [/.and] + (unit.coverage [/.and] (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad [pre (/.future instant.now) actual (/.after waiting_time expected) post (/.future instant.now)] - (_.coverage' [/.after] + (unit.coverage [/.after] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) @@ -118,7 +119,7 @@ (/.after waiting_time dummy)) ?right (/.or (/.after waiting_time dummy) (in rightE))] - (_.coverage' [/.or] + (unit.coverage [/.or] (case [?left ?right] [{.#Left leftA} {.#Right rightA}] (n.= (n.+ leftE rightE) @@ -131,7 +132,7 @@ (/.after waiting_time dummy)) rightA (/.either (/.after waiting_time dummy) (in rightE))] - (_.coverage' [/.either] + (unit.coverage [/.either] (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad @@ -139,7 +140,7 @@ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] (/.async []))] ?never (/.future (/.value async))] - (_.coverage' [/.value] + (unit.coverage [/.value] (case [?actual ?never] [{.#Some actual} {.#None}] (n.= expected actual) @@ -151,13 +152,13 @@ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] (/.async []))] nope (/.future (/.resolved? async))] - (_.coverage' [/.resolved?] + (unit.coverage [/.resolved?] (and yep (not nope))))) (in (do /.monad [?none (/.within 0 (/.after waiting_time dummy)) ?actual (/.within waiting_time (in expected))] - (_.coverage' [/.within] + (unit.coverage [/.within] (case [?none ?actual] [{.#None} {.#Some actual}] (n.= expected actual) @@ -171,6 +172,6 @@ (atom.write! value box)) (/.resolved expected))) actual (/.future (atom.read! box))] - (_.coverage' [/.upon!] + (unit.coverage [/.upon!] (n.= expected actual)))) )))) |