aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/concurrency/async.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-08-07 02:20:09 -0400
committerEduardo Julian2021-08-07 02:20:09 -0400
commit17e7566be51df5e428a6b10e6469201a8a9468da (patch)
tree0d4ed80c9c9d846784b5bf460f6e6f5fc5b96663 /stdlib/source/test/lux/control/concurrency/async.lux
parenteff4c59794868b89d60fdc411f9b544a270b817e (diff)
Made the be/de macros for (co)monadic expression extensible.
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/async.lux')
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux42
1 files changed, 21 insertions, 21 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index 8b7bafff8..063d3a9e0 100644
--- a/stdlib/source/test/lux/control/concurrency/async.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -54,10 +54,10 @@
Test
(<| (_.covering /._)
(do {! random.monad}
- [to_wait (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay))))
+ [waiting_time (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay))))
expected random.nat
dummy random.nat
- #let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))]
+ .let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))]
leftE not_dummy
rightE not_dummy]
($_ _.and
@@ -69,7 +69,7 @@
($monad.spec ..injection ..comparison /.monad))
(in (do /.monad
- [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)]
+ [.let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)]
(/.async []))]
resolved? (/.future (resolver expected))
actual async]
@@ -86,19 +86,19 @@
(n.= expected actual))))
(in (do /.monad
[pre (/.future instant.now)
- actual (/.schedule to_wait (io.io expected))
+ actual (/.schedule waiting_time (io.io expected))
post (/.future instant.now)]
(_.cover' [/.schedule]
(and (n.= expected actual)
- (i.>= (.int to_wait)
- (duration.to_millis (instant.span pre post)))))))
+ (i.>= (.int waiting_time)
+ (duration.millis (instant.span pre post)))))))
(in (do /.monad
[pre (/.future instant.now)
- _ (/.wait to_wait)
+ _ (/.wait waiting_time)
post (/.future instant.now)]
(_.cover' [/.wait]
- (i.>= (.int to_wait)
- (duration.to_millis (instant.span pre post))))))
+ (i.>= (.int waiting_time)
+ (duration.millis (instant.span pre post))))))
(in (do /.monad
[[leftA rightA] (/.and (/.future (io.io leftE))
(/.future (io.io rightE)))]
@@ -107,16 +107,16 @@
(n.+ leftA rightA)))))
(in (do /.monad
[pre (/.future instant.now)
- actual (/.delay to_wait expected)
+ actual (/.delay waiting_time expected)
post (/.future instant.now)]
(_.cover' [/.delay]
(and (n.= expected actual)
- (i.>= (.int to_wait)
- (duration.to_millis (instant.span pre post)))))))
+ (i.>= (.int waiting_time)
+ (duration.millis (instant.span pre post)))))))
(in (do /.monad
[?left (/.or (in leftE)
- (/.delay to_wait dummy))
- ?right (/.or (/.delay to_wait dummy)
+ (/.delay waiting_time dummy))
+ ?right (/.or (/.delay waiting_time dummy)
(in rightE))]
(_.cover' [/.or]
(case [?left ?right]
@@ -128,15 +128,15 @@
false))))
(in (do /.monad
[leftA (/.either (in leftE)
- (/.delay to_wait dummy))
- rightA (/.either (/.delay to_wait dummy)
+ (/.delay waiting_time dummy))
+ rightA (/.either (/.delay waiting_time 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)]
+ .let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)]
(/.async []))]
?never (/.future (/.poll async))]
(_.cover' [/.poll]
@@ -148,15 +148,15 @@
false))))
(in (do /.monad
[yep (/.future (/.resolved? (/.resolved expected)))
- #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)]
+ .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))]
+ [?none (/.time_out 0 (/.delay waiting_time dummy))
+ ?actual (/.time_out waiting_time (in expected))]
(_.cover' [/.time_out]
(case [?none ?actual]
[#.None (#.Some actual)]
@@ -165,7 +165,7 @@
_
false))))
(in (do /.monad
- [#let [box (: (Atom Nat)
+ [.let [box (: (Atom Nat)
(atom.atom dummy))]
_ (/.future (/.await (function (_ value)
(atom.write value box))