diff options
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/semaphore.lux')
-rw-r--r-- | stdlib/source/test/lux/control/concurrency/semaphore.lux | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index dcdb78f78..763ae41f8 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -30,8 +30,8 @@ Test (_.with-cover [/.Semaphore] ($_ _.and - (do {@ random.monad} - [initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1)))) + (do {! random.monad} + [initial-open-positions (|> random.nat (:: ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial-open-positions)]] (wrap (do promise.monad [result (promise.time-out 10 (/.wait semaphore))] @@ -42,11 +42,11 @@ #.None false))))) - (do {@ random.monad} - [initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1)))) + (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)) + (wrap (do {! promise.monad} + [_ (monad.map ! /.wait (list.repeat initial-open-positions semaphore)) result (promise.time-out 10 (/.wait semaphore))] (_.claim [/.wait] (case result @@ -55,11 +55,11 @@ #.None true))))) - (do {@ random.monad} - [initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1)))) + (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)) + (wrap (do {! promise.monad} + [_ (monad.map ! /.wait (list.repeat initial-open-positions semaphore)) #let [block (/.wait semaphore)] result/0 (promise.time-out 10 block) open-positions (/.signal semaphore) @@ -71,8 +71,8 @@ _ false))))) - (do {@ random.monad} - [initial-open-positions (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1)))) + (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)] @@ -89,8 +89,8 @@ Test (_.with-cover [/.Mutex] ($_ _.and - (do {@ random.monad} - [repetitions (|> random.nat (:: @ map (|>> (n.% 100) (n.max 10)))) + (do {! random.monad} + [repetitions (|> random.nat (:: ! map (|>> (n.% 100) (n.max 10)))) #let [resource (atom.atom "") expected-As (text.join-with "" (list.repeat repetitions "A")) expected-Bs (text.join-with "" (list.repeat repetitions "B")) @@ -98,16 +98,16 @@ processA (<| (/.synchronize mutex) io.io promise.future - (do {@ io.monad} - [_ (<| (monad.seq @) + (do {! io.monad} + [_ (<| (monad.seq !) (list.repeat repetitions) (atom.update (|>> (format "A")) resource))] (wrap []))) processB (<| (/.synchronize mutex) io.io promise.future - (do {@ io.monad} - [_ (<| (monad.seq @) + (do {! io.monad} + [_ (<| (monad.seq !) (list.repeat repetitions) (atom.update (|>> (format "B")) resource))] (wrap [])))]] @@ -146,11 +146,11 @@ _ false))) - (do {@ random.monad} - [limit (|> random.nat (:: @ map (|>> (n.% 10) (n.max 1)))) + (do {! random.monad} + [limit (|> random.nat (:: ! map (|>> (n.% 10) (n.max 1)))) #let [barrier (/.barrier (maybe.assume (/.limit limit))) resource (atom.atom "")]] - (wrap (do {@ promise.monad} + (wrap (do {! promise.monad} [#let [ending (|> "_" (list.repeat limit) (text.join-with "")) @@ -159,7 +159,7 @@ (exec (io.run (atom.update (|>> (format "_")) resource)) (waiter resource barrier id))) ids)] - _ (monad.seq @ waiters) + _ (monad.seq ! waiters) #let [outcome (io.run (atom.read resource))]] (_.claim [/.barrier /.block] (and (text.ends-with? ending outcome) |