aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/concurrency
diff options
context:
space:
mode:
authorEduardo Julian2021-08-24 05:23:45 -0400
committerEduardo Julian2021-08-24 05:23:45 -0400
commit36303d6cb2ce3ab9e36d045b9516c997bd461862 (patch)
treeb9d2f1495143054d61d9af129f36833624db9dac /stdlib/source/test/lux/control/concurrency
parentec1f31b5a1492d5e0ab260397291d4449483bbd9 (diff)
Outsourced the syntax for labelled type definitions to macros.
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency')
-rw-r--r--stdlib/source/test/lux/control/concurrency/actor.lux4
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux2
-rw-r--r--stdlib/source/test/lux/control/concurrency/frp.lux10
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux24
-rw-r--r--stdlib/source/test/lux/control/concurrency/stm.lux4
-rw-r--r--stdlib/source/test/lux/control/concurrency/thread.lux2
6 files changed, 23 insertions, 23 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux
index 93c68faff..c5c66d2fc 100644
--- a/stdlib/source/test/lux/control/concurrency/actor.lux
+++ b/stdlib/source/test/lux/control/concurrency/actor.lux
@@ -200,9 +200,9 @@
verdict)))
(do !
- [num_events (\ ! map (|>> (n.% 10) ++) random.nat)
+ [num_events (\ ! each (|>> (n.% 10) ++) random.nat)
events (random.list num_events random.nat)
- num_observations (\ ! map (n.% num_events) random.nat)
+ num_observations (\ ! each (n.% num_events) random.nat)
.let [expected (list.first num_observations events)
sink (: (Atom (Row Nat))
(atom.atom row.empty))]]
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index f9b917ee5..c6a858a5d 100644
--- a/stdlib/source/test/lux/control/concurrency/async.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -54,7 +54,7 @@
Test
(<| (_.covering /._)
(do {! random.monad}
- [waiting_time (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay))))
+ [waiting_time (|> random.nat (\ ! each (|>> (n.% ..delay) (n.+ ..delay))))
expected random.nat
dummy random.nat
.let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))]
diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux
index 174c8adc7..ad508df7b 100644
--- a/stdlib/source/test/lux/control/concurrency/frp.lux
+++ b/stdlib/source/test/lux/control/concurrency/frp.lux
@@ -59,7 +59,7 @@
(in #.End)
(#.Some [head tail])
- (\ ! map (|>> (#.Item head))
+ (\ ! each (|>> (#.Item head))
(take_amount (-- amount_of_polls) [channel sink]))))))
(def: .public test
@@ -152,12 +152,12 @@
(do !
[_ (!signal [])]
(in #.None)))))
- (/.sequential 0 (list\compose inputs inputs))))
+ (/.sequential 0 (list\composite inputs inputs))))
_ ?signal
listened (|> sink
atom.read!
async.future
- (\ ! map row.list))]
+ (\ ! each row.list))]
(_.cover' [/.Subscriber /.subscribe!]
(list\= inputs listened))))
(in (do async.monad
@@ -189,8 +189,8 @@
(list\= (list distint/0 distint/1 distint/2)
actual))))
(do !
- [polling_delay (\ ! map (|>> (n.% 10) ++) random.nat)
- amount_of_polls (\ ! map (|>> (n.% 10) ++) random.nat)]
+ [polling_delay (\ ! each (|>> (n.% 10) ++) random.nat)
+ amount_of_polls (\ ! each (|>> (n.% 10) ++) random.nat)]
($_ _.and
(in (do {! async.monad}
[actual (..take_amount amount_of_polls (/.poll polling_delay (: (IO Nat) (io.io sample))))
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index b4b07bbb0..796a1604e 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -39,7 +39,7 @@
(_.for [/.Semaphore]
($_ _.and
(do {! random.monad}
- [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
+ [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
[result (async.within ..delay (/.wait! semaphore))]
@@ -51,10 +51,10 @@
#.None
false)))))
(do {! random.monad}
- [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
+ [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do {! async.monad}
- [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore))
+ [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore))
result (async.within ..delay (/.wait! semaphore))]
(_.cover' [/.wait!]
(case result
@@ -64,10 +64,10 @@
#.None
true)))))
(do {! random.monad}
- [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
+ [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do {! async.monad}
- [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore))
+ [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore))
.let [block (/.wait! semaphore)]
result/0 (async.within ..delay block)
open_positions (/.signal! semaphore)
@@ -80,7 +80,7 @@
_
false)))))
(do {! random.monad}
- [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
+ [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1))))
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
[outcome (/.signal! semaphore)]
@@ -98,7 +98,7 @@
(_.for [/.Mutex]
($_ _.and
(do {! random.monad}
- [repetitions (|> random.nat (\ ! map (|>> (n.% 100) (n.max 10))))
+ [repetitions (|> random.nat (\ ! each (|>> (n.% 100) (n.max 10))))
.let [resource (atom.atom "")
expected_As (text.together (list.repeated repetitions "A"))
expected_Bs (text.together (list.repeated repetitions "B"))
@@ -155,7 +155,7 @@
_
false)))
(do {! random.monad}
- [limit (\ ! map (|>> (n.% 9) ++) random.nat)
+ [limit (\ ! each (|>> (n.% 9) ++) random.nat)
.let [barrier (/.barrier (maybe.trusted (/.limit limit)))
resource (atom.atom "")]]
(in (do {! async.monad}
@@ -165,10 +165,10 @@
text.together)
expected_ids (enum.range n.enum 0 (-- limit))]
_ (|> expected_ids
- (list\map (function (_ id)
- (exec
- (io.run! (atom.update! (|>> (format suffix)) resource))
- (waiter resource barrier id))))
+ (list\each (function (_ id)
+ (exec
+ (io.run! (atom.update! (|>> (format suffix)) resource))
+ (waiter resource barrier id))))
(monad.all !))
.let [outcome (io.run! (atom.read! resource))]]
(_.cover' [/.barrier /.block!]
diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux
index f3a5c618c..8d56cbed2 100644
--- a/stdlib/source/test/lux/control/concurrency/stm.lux
+++ b/stdlib/source/test/lux/control/concurrency/stm.lux
@@ -41,7 +41,7 @@
(do {! random.monad}
[dummy random.nat
expected random.nat
- iterations_per_process (|> random.nat (\ ! map (n.% 100)))]
+ iterations_per_process (|> random.nat (\ ! each (n.% 100)))]
($_ _.and
(_.for [/.functor]
($functor.spec ..injection ..comparison /.functor))
@@ -94,7 +94,7 @@
(in (let [var (/.var 0)]
(do {! async.monad}
[_ (|> (list.repeated iterations_per_process [])
- (list\map (function (_ _) (/.commit! (/.update ++ var))))
+ (list\each (function (_ _) (/.commit! (/.update ++ var))))
(monad.all !))
cummulative (/.commit! (/.read var))]
(_.cover' [/.STM]
diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux
index bee49206d..42c4c2d9f 100644
--- a/stdlib/source/test/lux/control/concurrency/thread.lux
+++ b/stdlib/source/test/lux/control/concurrency/thread.lux
@@ -26,7 +26,7 @@
(do {! random.monad}
[dummy random.nat
expected random.nat
- delay (\ ! map (|>> (n.% 5) (n.+ 5))
+ delay (\ ! each (|>> (n.% 5) (n.+ 5))
random.nat)]
($_ _.and
(_.cover [/.parallelism]