aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/concurrency
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency')
-rw-r--r--stdlib/source/test/lux/control/concurrency/actor.lux19
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux31
-rw-r--r--stdlib/source/test/lux/control/concurrency/frp.lux25
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux17
-rw-r--r--stdlib/source/test/lux/control/concurrency/stm.lux17
-rw-r--r--stdlib/source/test/lux/control/concurrency/thread.lux7
6 files changed, 61 insertions, 55 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux
index d3ecb4887..e4f3755c2 100644
--- a/stdlib/source/test/lux/control/concurrency/actor.lux
+++ b/stdlib/source/test/lux/control/concurrency/actor.lux
@@ -1,7 +1,6 @@
(.require
[library
[lux (.except)
- ["_" test (.only Test)]
[abstract
[monad (.only do)]]
[control
@@ -17,7 +16,9 @@
[math
["[0]" random]
[number
- ["n" nat]]]]]
+ ["n" nat]]]
+ ["_" test (.only Test)
+ ["[0]" unit]]]]
[\\library
["[0]" / (.only)
[//
@@ -101,7 +102,7 @@
(/.poison! actor)))
_ (async.delay 100)
result (async.future (async.value read))]
- (_.coverage' [/.poisoned]
+ (unit.coverage [/.poisoned]
(case result
{.#Some error}
(exception.match? /.poisoned error)
@@ -114,8 +115,8 @@
[actor (/.spawn! /.default 0)
sent? (/.mail! ++! actor)]
(in (..mailed? sent?))))]
- (_.coverage' [/.Behavior /.Mail
- /.default /.spawn! /.mail!]
+ (unit.coverage [/.Behavior /.Mail
+ /.default /.spawn! /.mail!]
sent?)))
(in (do async.monad
@@ -123,7 +124,7 @@
[counter (/.spawn! /.default 0)
_ (/.poison! counter)]
(/.mail! ++! counter)))]
- (_.coverage' [/.dead]
+ (unit.coverage [/.dead]
(case result
{try.#Success outcome}
false
@@ -141,7 +142,7 @@
alive? (/.alive? actor)
obituary (/.obituary' actor)]
(in {try.#Success [actor sent? alive? obituary]})))]
- (_.coverage' [/.Obituary /.obituary']
+ (unit.coverage [/.Obituary /.obituary']
(case result
{try.#Success [actor sent? alive? {.#Some [error state (list single_pending_message)]}]}
(and (..mailed? sent?)
@@ -162,7 +163,7 @@
(in (and (n.= 1 output_1)
(n.= 2 output_2)
(n.= 3 output_3))))]
- (_.coverage' [/.Message /.tell!]
+ (unit.coverage [/.Message /.tell!]
(case result
{try.#Success outcome}
outcome
@@ -196,6 +197,6 @@
(in agent)))
_ (/.obituary agent)
actual (async.future (atom.read! sink))]
- (_.coverage' [/.Stop /.observe! /.obituary]
+ (unit.coverage [/.Stop /.observe! /.obituary]
(at (list.equivalence n.equivalence) = expected (sequence.list actual))))))
))))
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index 42d938ddd..3cdaf2da4 100644
--- a/stdlib/source/test/lux/control/concurrency/async.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -1,7 +1,6 @@
(.require
[library
[lux (.except)
- ["_" test (.only Test)]
[abstract
[monad (.only do)]
[\\specification
@@ -21,7 +20,9 @@
[world
[time
["[0]" instant]
- ["[0]" duration]]]]]
+ ["[0]" duration]]]
+ ["_" test (.only Test)
+ ["[0]" unit]]]]
[\\library
["[0]" / (.only)
[//
@@ -73,22 +74,22 @@
(/.async []))]
resolved? (/.future (resolver expected))
actual async]
- (_.coverage' [/.Async /.Resolver /.async]
+ (unit.coverage [/.Async /.Resolver /.async]
(and resolved?
(n.= expected actual)))))
(in (do /.monad
[actual (/.resolved expected)]
- (_.coverage' [/.resolved]
+ (unit.coverage [/.resolved]
(n.= expected actual))))
(in (do /.monad
[actual (/.future (io.io expected))]
- (_.coverage' [/.future]
+ (unit.coverage [/.future]
(n.= expected actual))))
(in (do /.monad
[pre (/.future instant.now)
actual (/.schedule! waiting_time (io.io expected))
post (/.future instant.now)]
- (_.coverage' [/.schedule!]
+ (unit.coverage [/.schedule!]
(and (n.= expected actual)
(i.>= (.int waiting_time)
(duration.millis (instant.span pre post)))))))
@@ -96,20 +97,20 @@
[pre (/.future instant.now)
_ (/.delay waiting_time)
post (/.future instant.now)]
- (_.coverage' [/.delay]
+ (unit.coverage [/.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)))]
- (_.coverage' [/.and]
+ (unit.coverage [/.and]
(n.= (n.+ leftE rightE)
(n.+ leftA rightA)))))
(in (do /.monad
[pre (/.future instant.now)
actual (/.after waiting_time expected)
post (/.future instant.now)]
- (_.coverage' [/.after]
+ (unit.coverage [/.after]
(and (n.= expected actual)
(i.>= (.int waiting_time)
(duration.millis (instant.span pre post)))))))
@@ -118,7 +119,7 @@
(/.after waiting_time dummy))
?right (/.or (/.after waiting_time dummy)
(in rightE))]
- (_.coverage' [/.or]
+ (unit.coverage [/.or]
(case [?left ?right]
[{.#Left leftA} {.#Right rightA}]
(n.= (n.+ leftE rightE)
@@ -131,7 +132,7 @@
(/.after waiting_time dummy))
rightA (/.either (/.after waiting_time dummy)
(in rightE))]
- (_.coverage' [/.either]
+ (unit.coverage [/.either]
(n.= (n.+ leftE rightE)
(n.+ leftA rightA)))))
(in (do /.monad
@@ -139,7 +140,7 @@
.let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)]
(/.async []))]
?never (/.future (/.value async))]
- (_.coverage' [/.value]
+ (unit.coverage [/.value]
(case [?actual ?never]
[{.#Some actual} {.#None}]
(n.= expected actual)
@@ -151,13 +152,13 @@
.let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)]
(/.async []))]
nope (/.future (/.resolved? async))]
- (_.coverage' [/.resolved?]
+ (unit.coverage [/.resolved?]
(and yep
(not nope)))))
(in (do /.monad
[?none (/.within 0 (/.after waiting_time dummy))
?actual (/.within waiting_time (in expected))]
- (_.coverage' [/.within]
+ (unit.coverage [/.within]
(case [?none ?actual]
[{.#None} {.#Some actual}]
(n.= expected actual)
@@ -171,6 +172,6 @@
(atom.write! value box))
(/.resolved expected)))
actual (/.future (atom.read! box))]
- (_.coverage' [/.upon!]
+ (unit.coverage [/.upon!]
(n.= expected actual))))
))))
diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux
index 05fd6360c..147b8d2cb 100644
--- a/stdlib/source/test/lux/control/concurrency/frp.lux
+++ b/stdlib/source/test/lux/control/concurrency/frp.lux
@@ -1,7 +1,6 @@
(.require
[library
[lux (.except)
- ["_" test (.only Test)]
[abstract
[monad (.only do)]
[\\specification
@@ -19,7 +18,9 @@
[math
["[0]" random]
[number
- ["n" nat]]]]]
+ ["n" nat]]]
+ ["_" test (.only Test)
+ ["[0]" unit]]]]
[\\library
["[0]" / (.only)
[//
@@ -121,14 +122,14 @@
async.resolved
/.of_async
/.list)]
- (_.coverage' [/.of_async /.list]
+ (unit.coverage [/.of_async /.list]
(list#= (list sample)
output))))
(in (do async.monad
[output (|> inputs
(/.sequential 0)
/.list)]
- (_.coverage' [/.sequential]
+ (unit.coverage [/.sequential]
(list#= inputs
output))))
(in (do async.monad
@@ -136,7 +137,7 @@
(/.sequential 0)
(/.only n.even?)
/.list)]
- (_.coverage' [/.only]
+ (unit.coverage [/.only]
(list#= (list.only n.even? inputs)
output))))
(in (do [! async.monad]
@@ -160,14 +161,14 @@
atom.read!
async.future
(at ! each sequence.list))]
- (_.coverage' [/.Subscriber /.subscribe!]
+ (unit.coverage [/.Subscriber /.subscribe!]
(list#= inputs listened))))
(in (do async.monad
[actual (/.mix (function (_ input total)
(async.resolved (n.+ input total)))
0
(/.sequential 0 inputs))]
- (_.coverage' [/.mix]
+ (unit.coverage [/.mix]
(n.= (list#mix n.+ 0 inputs)
actual))))
(in (do async.monad
@@ -177,7 +178,7 @@
(async.resolved (n.+ input total)))
0)
/.list)]
- (_.coverage' [/.mixes]
+ (unit.coverage [/.mixes]
(list#= (list.mixes n.+ 0 inputs)
actual))))
(in (do async.monad
@@ -187,7 +188,7 @@
(/.sequential 0)
(/.distinct n.equivalence)
/.list)]
- (_.coverage' [/.distinct]
+ (unit.coverage [/.distinct]
(list#= (list distinct/0 distinct/1 distinct/2)
actual))))
(do !
@@ -201,12 +202,12 @@
enough_polls!
(n.= amount_of_polls (list.size actual))]]
- (_.coverage' [/.poll]
+ (unit.coverage [/.poll]
(and correct_values!
enough_polls!))))
(in (do [! async.monad]
[actual (..take_amount amount_of_polls (/.periodic polling_delay))]
- (_.coverage' [/.periodic]
+ (unit.coverage [/.periodic]
(n.= amount_of_polls (list.size actual)))))))
(in (do async.monad
[.let [max_iterations 10]
@@ -218,7 +219,7 @@
current]}
{.#None}))))
/.list)]
- (_.coverage' [/.iterations]
+ (unit.coverage [/.iterations]
(and (n.= max_iterations (list.size actual))
(list#= (list.mixes n.+ sample (list.repeated (-- max_iterations) shift))
actual)))))
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index ac4bd63b3..5254ce02f 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -1,7 +1,6 @@
(.require
[library
[lux (.except)
- ["_" test (.only Test)]
[abstract
["[0]" monad (.only do)]
["[0]" enum]]
@@ -26,7 +25,9 @@
[meta
["@" target]
[type
- ["[0]" refinement]]]]]
+ ["[0]" refinement]]]
+ ["_" test (.only Test)
+ ["[0]" unit]]]]
[\\library
["[0]" /]])
@@ -43,7 +44,7 @@
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
[result (async.within ..delay (/.wait! semaphore))]
- (_.coverage' [/.semaphore]
+ (unit.coverage [/.semaphore]
(case result
{.#Some _}
true
@@ -56,7 +57,7 @@
(in (do [! async.monad]
[_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore))
result (async.within ..delay (/.wait! semaphore))]
- (_.coverage' [/.wait!]
+ (unit.coverage [/.wait!]
(case result
{.#Some _}
false
@@ -72,7 +73,7 @@
result/0 (async.within ..delay block)
open_positions (/.signal! semaphore)
result/1 (async.within ..delay block)]
- (_.coverage' [/.signal!]
+ (unit.coverage [/.signal!]
(case [result/0 result/1 open_positions]
[{.#None} {.#Some _} {try.#Success +0}]
true
@@ -84,7 +85,7 @@
.let [semaphore (/.semaphore initial_open_positions)]]
(in (do async.monad
[outcome (/.signal! semaphore)]
- (_.coverage' [/.semaphore_is_maxed_out]
+ (unit.coverage [/.semaphore_is_maxed_out]
(case outcome
{try.#Failure error}
(exception.match? /.semaphore_is_maxed_out error)
@@ -123,7 +124,7 @@
[_ processA
_ processB
.let [outcome (io.run! (atom.read! resource))]]
- (_.coverage' [/.mutex /.synchronize!]
+ (unit.coverage [/.mutex /.synchronize!]
(or (text#= (format expected_As expected_Bs)
outcome)
(text#= (format expected_Bs expected_As)
@@ -171,7 +172,7 @@
(waiter resource barrier id))))
(monad.all !))
.let [outcome (io.run! (atom.read! resource))]]
- (_.coverage' [/.barrier /.block!]
+ (unit.coverage [/.barrier /.block!]
(and (text.ends_with? expected_ending outcome)
(list.every? (function (_ id)
(text.contains? (%.nat id) outcome))
diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux
index c5f5ce325..cb6fc3e81 100644
--- a/stdlib/source/test/lux/control/concurrency/stm.lux
+++ b/stdlib/source/test/lux/control/concurrency/stm.lux
@@ -1,7 +1,6 @@
(.require
[library
[lux (.except)
- ["_" test (.only Test)]
[abstract
["[0]" monad (.only Monad do)]
[\\specification
@@ -17,7 +16,9 @@
[math
["[0]" random]
[number
- ["n" nat]]]]]
+ ["n" nat]]]
+ ["_" test (.only Test)
+ ["[0]" unit]]]]
[\\library
["[0]" / (.only)
[//
@@ -52,11 +53,11 @@
(in (do async.monad
[actual (/.commit! (at /.monad in expected))]
- (_.coverage' [/.commit!]
+ (unit.coverage [/.commit!]
(n.= expected actual))))
(in (do async.monad
[actual (/.commit! (/.read (/.var expected)))]
- (_.coverage' [/.Var /.var /.read]
+ (unit.coverage [/.Var /.var /.read]
(n.= expected actual))))
(in (do async.monad
[actual (let [box (/.var dummy)]
@@ -68,7 +69,7 @@
[_ (/.write expected box)
actual (/.read box)]
(in (n.= expected actual)))))]
- (_.coverage' [/.write]
+ (unit.coverage [/.write]
(and (n.= expected actual)
verdict))))
(in (do async.monad
@@ -76,7 +77,7 @@
output (/.commit! (do /.monad
[_ (/.update (n.+ expected) box)]
(/.read box)))]
- (_.coverage' [/.update]
+ (unit.coverage [/.update]
(n.= (n.+ expected dummy)
output))))
(in (do async.monad
@@ -87,7 +88,7 @@
_ (async.future (at sink close))
_ (/.commit! (/.update (n.* 3) box))
changes (frp.list follower)]
- (_.coverage' [/.changes]
+ (unit.coverage [/.changes]
(at (list.equivalence n.equivalence) =
(list expected (n.* 2 expected))
changes))))
@@ -97,7 +98,7 @@
(list#each (function (_ _) (/.commit! (/.update ++ var))))
(monad.all !))
cummulative (/.commit! (/.read var))]
- (_.coverage' [/.STM]
+ (unit.coverage [/.STM]
(n.= iterations_per_process
cummulative)))))
))))
diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux
index da2a9ea37..83a626c4f 100644
--- a/stdlib/source/test/lux/control/concurrency/thread.lux
+++ b/stdlib/source/test/lux/control/concurrency/thread.lux
@@ -1,7 +1,6 @@
(.require
[library
[lux (.except)
- ["_" test (.only Test)]
[abstract
[monad (.only do)]]
[control
@@ -14,7 +13,9 @@
[world
[time
["[0]" instant (.only Instant)]
- ["[0]" duration]]]]]
+ ["[0]" duration]]]
+ ["_" test (.only Test)
+ ["[0]" unit]]]]
[\\library
["[0]" / (.only)
[//
@@ -41,7 +42,7 @@
(atom.write! [execution_time expected] box))))
_ (async.delay (n.* 2 delay))
[execution_time actual] (async.future (atom.read! box))]
- (_.coverage' [/.schedule!]
+ (unit.coverage [/.schedule!]
(let [expected_delay!
(i.>= (.int delay)
(duration.millis (instant.span reference_time execution_time)))