diff options
Diffstat (limited to 'stdlib/source/test/lux/control/concurrency/semaphore.lux')
-rw-r--r-- | stdlib/source/test/lux/control/concurrency/semaphore.lux | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 252f557b9..275613ebd 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -42,26 +42,26 @@ .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [result (async.within ..delay (/.wait! semaphore))] - (_.cover' [/.semaphore] - (case result - {.#Some _} - true + (_.coverage' [/.semaphore] + (case result + {.#Some _} + true - {.#None} - false))))) + {.#None} + false))))) (do [! random.monad] [initial_open_positions (|> random.nat (# ! each (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do [! async.monad] [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore)) result (async.within ..delay (/.wait! semaphore))] - (_.cover' [/.wait!] - (case result - {.#Some _} - false + (_.coverage' [/.wait!] + (case result + {.#Some _} + false - {.#None} - true))))) + {.#None} + true))))) (do [! random.monad] [initial_open_positions (|> random.nat (# ! each (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] @@ -71,25 +71,25 @@ result/0 (async.within ..delay block) open_positions (/.signal! semaphore) result/1 (async.within ..delay block)] - (_.cover' [/.signal!] - (case [result/0 result/1 open_positions] - [{.#None} {.#Some _} {try.#Success +0}] - true + (_.coverage' [/.signal!] + (case [result/0 result/1 open_positions] + [{.#None} {.#Some _} {try.#Success +0}] + true - _ - false))))) + _ + false))))) (do [! random.monad] [initial_open_positions (|> random.nat (# ! each (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [outcome (/.signal! semaphore)] - (_.cover' [/.semaphore_is_maxed_out] - (case outcome - {try.#Failure error} - (exception.match? /.semaphore_is_maxed_out error) + (_.coverage' [/.semaphore_is_maxed_out] + (case outcome + {try.#Failure error} + (exception.match? /.semaphore_is_maxed_out error) - _ - false))))) + _ + false))))) ))) (def: mutex @@ -122,11 +122,11 @@ [_ processA _ processB .let [outcome (io.run! (atom.read! resource))]] - (_.cover' [/.mutex /.synchronize!] - (or (text#= (format expected_As expected_Bs) - outcome) - (text#= (format expected_Bs expected_As) - outcome)))))) + (_.coverage' [/.mutex /.synchronize!] + (or (text#= (format expected_As expected_Bs) + outcome) + (text#= (format expected_Bs expected_As) + outcome)))))) ))) (def: (waiter resource barrier id) @@ -142,17 +142,17 @@ (all _.and (do random.monad [raw random.nat] - (_.cover [/.Limit /.limit] - (case [raw (/.limit raw)] - [0 {.#None}] - true - - [_ {.#Some limit}] - (and (n.> 0 raw) - (n.= raw (refinement.value limit))) + (_.coverage [/.Limit /.limit] + (case [raw (/.limit raw)] + [0 {.#None}] + true + + [_ {.#Some limit}] + (and (n.> 0 raw) + (n.= raw (refinement.value limit))) - _ - false))) + _ + false))) (do [! random.monad] [limit (# ! each (|>> (n.% 9) ++) random.nat) .let [barrier (/.barrier (maybe.trusted (/.limit limit))) @@ -170,11 +170,11 @@ (waiter resource barrier id)))) (monad.all !)) .let [outcome (io.run! (atom.read! resource))]] - (_.cover' [/.barrier /.block!] - (and (text.ends_with? expected_ending outcome) - (list.every? (function (_ id) - (text.contains? (%.nat id) outcome)) - expected_ids)))))) + (_.coverage' [/.barrier /.block!] + (and (text.ends_with? expected_ending outcome) + (list.every? (function (_ id) + (text.contains? (%.nat id) outcome)) + expected_ids)))))) ))) (def: .public test |