diff options
author | Eduardo Julian | 2021-07-27 03:51:10 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-07-27 03:51:10 -0400 |
commit | 061fd8a209bbcaffc2bfb850ac6046752a567d50 (patch) | |
tree | 8cd83ad7d0bc06ded7976eb5420467e485733ae8 /stdlib/source/test/lux/control/concurrency/async.lux | |
parent | e64b6d0114c26a455e19a416b5f02a4d19dd711f (diff) |
Re-named wrap => in && unwrap => out.
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/async.lux')
-rw-r--r-- | stdlib/source/test/lux/control/concurrency/async.lux | 216 |
1 files changed, 108 insertions, 108 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 1c7d075f4..5a92f595a 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -37,13 +37,13 @@ (do io.monad [?left (/.poll left) ?right (/.poll right)] - (wrap (case [?left ?right] - [(#.Some left) - (#.Some right)] - (== left right) - - _ - false)))))) + (in (case [?left ?right] + [(#.Some left) + (#.Some right)] + (== left right) + + _ + false)))))) (def: delay (for {@.js @@ -68,109 +68,109 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (wrap (do /.monad - [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] - resolved? (/.future (resolver expected)) - actual async] - (_.cover' [/.Async /.Resolver /.async] - (and resolved? - (n.= expected actual))))) - (wrap (do /.monad - [actual (/.resolved expected)] - (_.cover' [/.resolved] - (n.= expected actual)))) - (wrap (do /.monad - [actual (/.future (io.io expected))] - (_.cover' [/.future] - (n.= expected actual)))) - (wrap (do /.monad - [pre (/.future instant.now) - actual (/.schedule to_wait (io.io expected)) - post (/.future instant.now)] - (_.cover' [/.schedule] - (and (n.= expected actual) - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post))))))) - (wrap (do /.monad - [pre (/.future instant.now) - _ (/.wait to_wait) - post (/.future instant.now)] - (_.cover' [/.wait] - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post)))))) - (wrap (do /.monad - [[leftA rightA] (/.and (/.future (io.io leftE)) - (/.future (io.io rightE)))] - (_.cover' [/.and] + (in (do /.monad + [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + resolved? (/.future (resolver expected)) + actual async] + (_.cover' [/.Async /.Resolver /.async] + (and resolved? + (n.= expected actual))))) + (in (do /.monad + [actual (/.resolved expected)] + (_.cover' [/.resolved] + (n.= expected actual)))) + (in (do /.monad + [actual (/.future (io.io expected))] + (_.cover' [/.future] + (n.= expected actual)))) + (in (do /.monad + [pre (/.future instant.now) + actual (/.schedule to_wait (io.io expected)) + post (/.future instant.now)] + (_.cover' [/.schedule] + (and (n.= expected actual) + (i.>= (.int to_wait) + (duration.to_millis (instant.span pre post))))))) + (in (do /.monad + [pre (/.future instant.now) + _ (/.wait to_wait) + post (/.future instant.now)] + (_.cover' [/.wait] + (i.>= (.int to_wait) + (duration.to_millis (instant.span pre post)))))) + (in (do /.monad + [[leftA rightA] (/.and (/.future (io.io leftE)) + (/.future (io.io rightE)))] + (_.cover' [/.and] + (n.= (n.+ leftE rightE) + (n.+ leftA rightA))))) + (in (do /.monad + [pre (/.future instant.now) + actual (/.delay to_wait expected) + post (/.future instant.now)] + (_.cover' [/.delay] + (and (n.= expected actual) + (i.>= (.int to_wait) + (duration.to_millis (instant.span pre post))))))) + (in (do /.monad + [?left (/.or (in leftE) + (/.delay to_wait dummy)) + ?right (/.or (/.delay to_wait dummy) + (in rightE))] + (_.cover' [/.or] + (case [?left ?right] + [(#.Left leftA) (#.Right rightA)] (n.= (n.+ leftE rightE) - (n.+ leftA rightA))))) - (wrap (do /.monad - [pre (/.future instant.now) - actual (/.delay to_wait expected) - post (/.future instant.now)] - (_.cover' [/.delay] - (and (n.= expected actual) - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post))))))) - (wrap (do /.monad - [?left (/.or (wrap leftE) - (/.delay to_wait dummy)) - ?right (/.or (/.delay to_wait dummy) - (wrap rightE))] - (_.cover' [/.or] - (case [?left ?right] - [(#.Left leftA) (#.Right rightA)] - (n.= (n.+ leftE rightE) - (n.+ leftA rightA)) + (n.+ leftA rightA)) - _ - false)))) - (wrap (do /.monad - [leftA (/.either (wrap leftE) - (/.delay to_wait dummy)) - rightA (/.either (/.delay to_wait dummy) - (wrap rightE))] - (_.cover' [/.either] - (n.= (n.+ leftE rightE) - (n.+ leftA rightA))))) - (wrap (do /.monad - [?actual (/.future (/.poll (/.resolved expected))) - #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] - ?never (/.future (/.poll async))] - (_.cover' [/.poll] - (case [?actual ?never] - [(#.Some actual) #.None] - (n.= expected actual) + _ + false)))) + (in (do /.monad + [leftA (/.either (in leftE) + (/.delay to_wait dummy)) + rightA (/.either (/.delay to_wait dummy) + (in rightE))] + (_.cover' [/.either] + (n.= (n.+ leftE rightE) + (n.+ leftA rightA))))) + (in (do /.monad + [?actual (/.future (/.poll (/.resolved expected))) + #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + ?never (/.future (/.poll async))] + (_.cover' [/.poll] + (case [?actual ?never] + [(#.Some actual) #.None] + (n.= expected actual) - _ - false)))) - (wrap (do /.monad - [yep (/.future (/.resolved? (/.resolved expected))) - #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] - nope (/.future (/.resolved? async))] - (_.cover' [/.resolved?] - (and yep - (not nope))))) - (wrap (do /.monad - [?none (/.time_out 0 (/.delay to_wait dummy)) - ?actual (/.time_out to_wait (wrap expected))] - (_.cover' [/.time_out] - (case [?none ?actual] - [#.None (#.Some actual)] - (n.= expected actual) + _ + false)))) + (in (do /.monad + [yep (/.future (/.resolved? (/.resolved expected))) + #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + nope (/.future (/.resolved? async))] + (_.cover' [/.resolved?] + (and yep + (not nope))))) + (in (do /.monad + [?none (/.time_out 0 (/.delay to_wait dummy)) + ?actual (/.time_out to_wait (in expected))] + (_.cover' [/.time_out] + (case [?none ?actual] + [#.None (#.Some actual)] + (n.= expected actual) - _ - false)))) - (wrap (do /.monad - [#let [box (: (Atom Nat) - (atom.atom dummy))] - _ (/.future (/.await (function (_ value) - (atom.write value box)) - (/.resolved expected))) - actual (/.future (atom.read box))] - (_.cover' [/.await] - (n.= expected actual)))) + _ + false)))) + (in (do /.monad + [#let [box (: (Atom Nat) + (atom.atom dummy))] + _ (/.future (/.await (function (_ value) + (atom.write value box)) + (/.resolved expected))) + actual (/.future (atom.read box))] + (_.cover' [/.await] + (n.= expected actual)))) )))) |