aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/concurrency/async.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-04-08 05:42:36 -0400
committerEduardo Julian2022-04-08 05:42:36 -0400
commit0d909187d5b9effcd08f533d50af7d29c0d6bfd8 (patch)
treec50f12c5e47e3db90c3a701b54ee9953da942210 /stdlib/source/test/lux/control/concurrency/async.lux
parente5e4c2aff562e5c01fefb808d1d68a40f29c9cc5 (diff)
De-sigil-ification: $
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/async.lux')
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux222
1 files changed, 111 insertions, 111 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index 7a61769b8..e43619f2c 100644
--- a/stdlib/source/test/lux/control/concurrency/async.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -58,117 +58,117 @@
.let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))]
leftE not_dummy
rightE not_dummy]
- ($_ _.and
- (_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
- (_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
- (_.for [/.monad]
- ($monad.spec ..injection ..comparison /.monad))
-
- (in (do /.monad
- [.let [[async resolver] (is [(/.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! waiting_time (io.io expected))
- post (/.future instant.now)]
- (_.cover' [/.schedule!]
- (and (n.= expected actual)
- (i.>= (.int waiting_time)
- (duration.millis (instant.span pre post)))))))
- (in (do /.monad
- [pre (/.future instant.now)
- _ (/.delay waiting_time)
- post (/.future instant.now)]
- (_.cover' [/.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)))]
- (_.cover' [/.and]
- (n.= (n.+ leftE rightE)
- (n.+ leftA rightA)))))
- (in (do /.monad
- [pre (/.future instant.now)
- actual (/.after waiting_time expected)
- post (/.future instant.now)]
- (_.cover' [/.after]
- (and (n.= expected actual)
- (i.>= (.int waiting_time)
- (duration.millis (instant.span pre post)))))))
- (in (do /.monad
- [?left (/.or (in leftE)
- (/.after waiting_time dummy))
- ?right (/.or (/.after waiting_time dummy)
- (in rightE))]
- (_.cover' [/.or]
- (case [?left ?right]
- [{.#Left leftA} {.#Right rightA}]
- (n.= (n.+ leftE rightE)
- (n.+ leftA rightA))
+ (all _.and
+ (_.for [/.functor]
+ ($functor.spec ..injection ..comparison /.functor))
+ (_.for [/.apply]
+ ($apply.spec ..injection ..comparison /.apply))
+ (_.for [/.monad]
+ ($monad.spec ..injection ..comparison /.monad))
+
+ (in (do /.monad
+ [.let [[async resolver] (is [(/.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! waiting_time (io.io expected))
+ post (/.future instant.now)]
+ (_.cover' [/.schedule!]
+ (and (n.= expected actual)
+ (i.>= (.int waiting_time)
+ (duration.millis (instant.span pre post)))))))
+ (in (do /.monad
+ [pre (/.future instant.now)
+ _ (/.delay waiting_time)
+ post (/.future instant.now)]
+ (_.cover' [/.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)))]
+ (_.cover' [/.and]
+ (n.= (n.+ leftE rightE)
+ (n.+ leftA rightA)))))
+ (in (do /.monad
+ [pre (/.future instant.now)
+ actual (/.after waiting_time expected)
+ post (/.future instant.now)]
+ (_.cover' [/.after]
+ (and (n.= expected actual)
+ (i.>= (.int waiting_time)
+ (duration.millis (instant.span pre post)))))))
+ (in (do /.monad
+ [?left (/.or (in leftE)
+ (/.after waiting_time dummy))
+ ?right (/.or (/.after waiting_time dummy)
+ (in rightE))]
+ (_.cover' [/.or]
+ (case [?left ?right]
+ [{.#Left leftA} {.#Right rightA}]
+ (n.= (n.+ leftE rightE)
+ (n.+ leftA rightA))
- _
- false))))
- (in (do /.monad
- [leftA (/.either (in leftE)
- (/.after waiting_time dummy))
- rightA (/.either (/.after waiting_time dummy)
- (in rightE))]
- (_.cover' [/.either]
- (n.= (n.+ leftE rightE)
- (n.+ leftA rightA)))))
- (in (do /.monad
- [?actual (/.future (/.value (/.resolved expected)))
- .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)]
- (/.async []))]
- ?never (/.future (/.value async))]
- (_.cover' [/.value]
- (case [?actual ?never]
- [{.#Some actual} {.#None}]
- (n.= expected actual)
+ _
+ false))))
+ (in (do /.monad
+ [leftA (/.either (in leftE)
+ (/.after waiting_time dummy))
+ rightA (/.either (/.after waiting_time dummy)
+ (in rightE))]
+ (_.cover' [/.either]
+ (n.= (n.+ leftE rightE)
+ (n.+ leftA rightA)))))
+ (in (do /.monad
+ [?actual (/.future (/.value (/.resolved expected)))
+ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)]
+ (/.async []))]
+ ?never (/.future (/.value async))]
+ (_.cover' [/.value]
+ (case [?actual ?never]
+ [{.#Some actual} {.#None}]
+ (n.= expected actual)
- _
- false))))
- (in (do /.monad
- [yep (/.future (/.resolved? (/.resolved expected)))
- .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)]
- (/.async []))]
- nope (/.future (/.resolved? async))]
- (_.cover' [/.resolved?]
- (and yep
- (not nope)))))
- (in (do /.monad
- [?none (/.within 0 (/.after waiting_time dummy))
- ?actual (/.within waiting_time (in expected))]
- (_.cover' [/.within]
- (case [?none ?actual]
- [{.#None} {.#Some actual}]
- (n.= expected actual)
+ _
+ false))))
+ (in (do /.monad
+ [yep (/.future (/.resolved? (/.resolved expected)))
+ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)]
+ (/.async []))]
+ nope (/.future (/.resolved? async))]
+ (_.cover' [/.resolved?]
+ (and yep
+ (not nope)))))
+ (in (do /.monad
+ [?none (/.within 0 (/.after waiting_time dummy))
+ ?actual (/.within waiting_time (in expected))]
+ (_.cover' [/.within]
+ (case [?none ?actual]
+ [{.#None} {.#Some actual}]
+ (n.= expected actual)
- _
- false))))
- (in (do /.monad
- [.let [box (is (Atom Nat)
- (atom.atom dummy))]
- _ (/.future (/.upon! (function (_ value)
- (atom.write! value box))
- (/.resolved expected)))
- actual (/.future (atom.read! box))]
- (_.cover' [/.upon!]
- (n.= expected actual))))
- ))))
+ _
+ false))))
+ (in (do /.monad
+ [.let [box (is (Atom Nat)
+ (atom.atom dummy))]
+ _ (/.future (/.upon! (function (_ value)
+ (atom.write! value box))
+ (/.resolved expected)))
+ actual (/.future (atom.read! box))]
+ (_.cover' [/.upon!]
+ (n.= expected actual))))
+ ))))