diff options
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/semaphore.lux')
-rw-r--r-- | stdlib/source/test/lux/control/concurrency/semaphore.lux | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index fa81183cd..d1c6ac1e4 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -35,26 +35,26 @@ #let [semaphore (/.semaphore initial-open-positions)]] (wrap (do promise.monad [result (promise.time-out 10 (/.wait semaphore))] - (_.claim [/.semaphore] - (case result - (#.Some _) - true + (_.cover' [/.semaphore] + (case result + (#.Some _) + true - #.None - false))))) + #.None + false))))) (do {! random.monad} [initial-open-positions (|> random.nat (:: ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial-open-positions)]] (wrap (do {! promise.monad} [_ (monad.map ! /.wait (list.repeat initial-open-positions semaphore)) result (promise.time-out 10 (/.wait semaphore))] - (_.claim [/.wait] - (case result - (#.Some _) - false + (_.cover' [/.wait] + (case result + (#.Some _) + false - #.None - true))))) + #.None + true))))) (do {! random.monad} [initial-open-positions (|> random.nat (:: ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial-open-positions)]] @@ -64,25 +64,25 @@ result/0 (promise.time-out 10 block) open-positions (/.signal semaphore) result/1 (promise.time-out 10 block)] - (_.claim [/.signal] - (case [result/0 result/1 open-positions] - [#.None (#.Some _) (#try.Success +0)] - true + (_.cover' [/.signal] + (case [result/0 result/1 open-positions] + [#.None (#.Some _) (#try.Success +0)] + true - _ - false))))) + _ + false))))) (do {! random.monad} [initial-open-positions (|> random.nat (:: ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial-open-positions)]] (wrap (do promise.monad [outcome (/.signal semaphore)] - (_.claim [/.semaphore-is-maxed-out] - (case outcome - (#try.Failure error) - (exception.match? /.semaphore-is-maxed-out error) + (_.cover' [/.semaphore-is-maxed-out] + (case outcome + (#try.Failure error) + (exception.match? /.semaphore-is-maxed-out error) - _ - false))))) + _ + false))))) ))) (def: mutex @@ -115,11 +115,11 @@ [_ processA _ processB #let [outcome (io.run (atom.read resource))]] - (_.claim [/.mutex /.synchronize] - (or (text\= (format expected-As expected-Bs) - outcome) - (text\= (format expected-Bs expected-As) - outcome)))))) + (_.cover' [/.mutex /.synchronize] + (or (text\= (format expected-As expected-Bs) + outcome) + (text\= (format expected-Bs expected-As) + outcome)))))) ))) (def: (waiter resource barrier id) @@ -161,12 +161,12 @@ ids)] _ (monad.seq ! waiters) #let [outcome (io.run (atom.read resource))]] - (_.claim [/.barrier /.block] - (and (text.ends-with? ending outcome) - (list.every? (function (_ id) - (text.contains? (%.nat id) outcome)) - ids) - ))))) + (_.cover' [/.barrier /.block] + (and (text.ends-with? ending outcome) + (list.every? (function (_ id) + (text.contains? (%.nat id) outcome)) + ids) + ))))) ))) (def: #export test |