aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/concurrency/semaphore.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/semaphore.lux')
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux22
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index 3ccf611a3..c93b51358 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -38,7 +38,7 @@
Test
(_.for [/.Semaphore]
($_ _.and
- (do {! random.monad}
+ (do [! random.monad]
[initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
@@ -50,10 +50,10 @@
#.None
false)))))
- (do {! random.monad}
+ (do [! random.monad]
[initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
- (in (do {! async.monad}
+ (in (do [! async.monad]
[_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore))
result (async.within ..delay (/.wait! semaphore))]
(_.cover' [/.wait!]
@@ -63,10 +63,10 @@
#.None
true)))))
- (do {! random.monad}
+ (do [! random.monad]
[initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
- (in (do {! async.monad}
+ (in (do [! async.monad]
[_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore))
.let [block (/.wait! semaphore)]
result/0 (async.within ..delay block)
@@ -79,7 +79,7 @@
_
false)))))
- (do {! random.monad}
+ (do [! random.monad]
[initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
@@ -97,7 +97,7 @@
Test
(_.for [/.Mutex]
($_ _.and
- (do {! random.monad}
+ (do [! random.monad]
[repetitions (|> random.nat (\ ! each (|>> (n.% 100) (n.max 10))))
.let [resource (atom.atom "")
expected_As (text.together (list.repeated repetitions "A"))
@@ -106,7 +106,7 @@
processA (<| (/.synchronize! mutex)
io.io
async.future
- (do {! io.monad}
+ (do [! io.monad]
[_ (<| (monad.all !)
(list.repeated repetitions)
(atom.update! (|>> (format "A")) resource))]
@@ -114,7 +114,7 @@
processB (<| (/.synchronize! mutex)
io.io
async.future
- (do {! io.monad}
+ (do [! io.monad]
[_ (<| (monad.all !)
(list.repeated repetitions)
(atom.update! (|>> (format "B")) resource))]
@@ -154,11 +154,11 @@
_
false)))
- (do {! random.monad}
+ (do [! random.monad]
[limit (\ ! each (|>> (n.% 9) ++) random.nat)
.let [barrier (/.barrier (maybe.trusted (/.limit limit)))
resource (atom.atom "")]]
- (in (do {! async.monad}
+ (in (do [! async.monad]
[.let [suffix "_"
expected_ending (|> suffix
(list.repeated limit)