aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/test.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-08-18 03:29:15 -0400
committerEduardo Julian2021-08-18 03:29:15 -0400
commite00ba096c8837abe85d366e0c1293c09dbe84d81 (patch)
treedc1f0955d4461ae30bb4945cddd74c462f1aee98 /stdlib/source/test/lux/test.lux
parent3289b9dcf9d5d1c1e5c380e3185065c8fd32535f (diff)
Some bug fixes.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/test.lux112
1 files changed, 56 insertions, 56 deletions
diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux
index eef7b91e7..e51623e28 100644
--- a/stdlib/source/test/lux/test.lux
+++ b/stdlib/source/test/lux/test.lux
@@ -25,8 +25,8 @@
(-> Text Text Nat Nat [/.Tally Text] Bit)
(and (text.contains? expected_message/0 message)
(text.contains? expected_message/1 message)
- (n.= successes (get@ #/.successes tally))
- (n.= failures (get@ #/.failures tally))))
+ (n.= successes (value@ #/.successes tally))
+ (n.= failures (value@ #/.failures tally))))
(def: assertion
/.Test
@@ -41,10 +41,10 @@
(/.cover' [/.assertion /.Tally]
(and (text.ends_with? expected_message/0 success_message)
(text.ends_with? expected_message/0 failure_message)
- (and (n.= 1 (get@ #/.successes success_tally))
- (n.= 0 (get@ #/.failures success_tally)))
- (and (n.= 0 (get@ #/.successes failure_tally))
- (n.= 1 (get@ #/.failures failure_tally)))))))
+ (and (n.= 1 (value@ #/.successes success_tally))
+ (n.= 0 (value@ #/.failures success_tally)))
+ (and (n.= 0 (value@ #/.successes failure_tally))
+ (n.= 1 (value@ #/.failures failure_tally)))))))
(in (do async.monad
[tt (/.and' (/.assertion expected_message/0 true)
(/.assertion expected_message/1 true))
@@ -82,10 +82,10 @@
[[pre_tally pre_message] pre
[post_tally post_message] post]
(/.cover' [/.seed]
- (and (and (n.= 1 (get@ #/.successes pre_tally))
- (n.= 0 (get@ #/.failures pre_tally)))
- (and (n.= 1 (get@ #/.successes post_tally))
- (n.= 0 (get@ #/.failures post_tally)))))))))
+ (and (and (n.= 1 (value@ #/.successes pre_tally))
+ (n.= 0 (value@ #/.failures pre_tally)))
+ (and (n.= 1 (value@ #/.successes post_tally))
+ (n.= 0 (value@ #/.failures post_tally)))))))))
(def: times
/.Test
@@ -95,32 +95,32 @@
(in (do async.monad
[[tally error] times_assertion]
(/.cover' [/.must_try_test_at_least_once]
- (and (text.contains? (get@ #exception.label /.must_try_test_at_least_once) error)
- (n.= 0 (get@ #/.successes tally))
- (n.= 1 (get@ #/.failures tally)))))))
+ (and (text.contains? (value@ #exception.label /.must_try_test_at_least_once) error)
+ (n.= 0 (value@ #/.successes tally))
+ (n.= 1 (value@ #/.failures tally)))))))
(do {! random.monad}
- [expected (\ ! map (|>> (n.% 10) inc) random.nat)
+ [expected (\ ! map (|>> (n.% 10) ++) random.nat)
.let [counter (: (Atom Nat)
(atom.atom 0))]
times_assertion (<| (/.times expected)
(do !
[_ (in [])
- .let [_ (io.run! (atom.update! inc counter))]]
+ .let [_ (io.run! (atom.update! ++ counter))]]
(/.test "" true)))]
(in (do async.monad
[[tally error] times_assertion
actual (async.future (atom.read! counter))]
(/.cover' [/.times]
(and (n.= expected actual)
- (n.= 1 (get@ #/.successes tally))
- (n.= 0 (get@ #/.failures tally)))))))
+ (n.= 1 (value@ #/.successes tally))
+ (n.= 0 (value@ #/.failures tally)))))))
))
(def: in_parallel
/.Test
($_ /.and
(do {! random.monad}
- [expected (\ ! map (|>> (n.% 10) inc) random.nat)
+ [expected (\ ! map (|>> (n.% 10) ++) random.nat)
.let [counter (: (Atom Nat)
(atom.atom 0))]
assertion (<| /.in_parallel
@@ -128,17 +128,17 @@
(: /.Test)
(do !
[_ (in [])
- .let [_ (io.run! (atom.update! inc counter))]]
+ .let [_ (io.run! (atom.update! ++ counter))]]
(/.test "" true)))]
(in (do async.monad
[[tally error] assertion
actual (async.future (atom.read! counter))]
(/.cover' [/.in_parallel]
(and (n.= expected actual)
- (n.= expected (get@ #/.successes tally))
- (n.= 0 (get@ #/.failures tally)))))))
+ (n.= expected (value@ #/.successes tally))
+ (n.= 0 (value@ #/.failures tally)))))))
(do {! random.monad}
- [expected (\ ! map (|>> (n.% 10) inc) random.nat)
+ [expected (\ ! map (|>> (n.% 10) ++) random.nat)
.let [counter (: (Atom Nat)
(atom.atom 0))]
assertion (<| /.in_parallel
@@ -147,16 +147,16 @@
(do !
[_ (in [])
.let [_ (undefined)
- _ (io.run! (atom.update! inc counter))]]
+ _ (io.run! (atom.update! ++ counter))]]
(/.test "" true)))]
(in (do async.monad
[[tally error] assertion
actual (async.future (atom.read! counter))]
(/.cover' [/.error_during_execution]
- (let [correct_error! (text.contains? (get@ #exception.label /.error_during_execution) error)
+ (let [correct_error! (text.contains? (value@ #exception.label /.error_during_execution) error)
no_complete_run! (n.= 0 actual)
- no_successes! (n.= 0 (get@ #/.successes tally))
- ran_all_tests! (n.= expected (get@ #/.failures tally))]
+ no_successes! (n.= 0 (value@ #/.successes tally))
+ ran_all_tests! (n.= expected (value@ #/.failures tally))]
(and correct_error!
no_complete_run!
no_successes!
@@ -176,10 +176,10 @@
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.covering]
- (and (and (set.empty? (get@ #/.expected_coverage not_covering))
- (set.empty? (get@ #/.actual_coverage not_covering)))
- (and (not (set.empty? (get@ #/.expected_coverage covering)))
- (set.empty? (get@ #/.actual_coverage covering))))))))
+ (and (and (set.empty? (value@ #/.expected_coverage not_covering))
+ (set.empty? (value@ #/.actual_coverage not_covering)))
+ (and (not (set.empty? (value@ #/.expected_coverage covering)))
+ (set.empty? (value@ #/.actual_coverage covering))))))))
(do random.monad
[not_covering (/.covering .._ (/.test "" true))
covering (/.covering .._ (/.cover [..dummy_target] true))]
@@ -187,10 +187,10 @@
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.cover]
- (and (and (not (set.empty? (get@ #/.expected_coverage not_covering)))
- (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target))))
- (and (not (set.empty? (get@ #/.expected_coverage covering)))
- (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target))))))))
+ (and (and (not (set.empty? (value@ #/.expected_coverage not_covering)))
+ (not (set.member? (value@ #/.actual_coverage not_covering) (name_of ..dummy_target))))
+ (and (not (set.empty? (value@ #/.expected_coverage covering)))
+ (set.member? (value@ #/.actual_coverage covering) (name_of ..dummy_target))))))))
(do random.monad
[not_covering (/.covering .._ (/.test "" true))
covering (/.covering .._ (in (/.cover' [..dummy_target] true)))]
@@ -198,10 +198,10 @@
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.cover']
- (and (and (not (set.empty? (get@ #/.expected_coverage not_covering)))
- (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target))))
- (and (not (set.empty? (get@ #/.expected_coverage covering)))
- (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target))))))))
+ (and (and (not (set.empty? (value@ #/.expected_coverage not_covering)))
+ (not (set.member? (value@ #/.actual_coverage not_covering) (name_of ..dummy_target))))
+ (and (not (set.empty? (value@ #/.expected_coverage covering)))
+ (set.member? (value@ #/.actual_coverage covering) (name_of ..dummy_target))))))))
(do random.monad
[not_covering (/.covering .._ (/.test "" true))
covering (/.covering .._ (/.for [..dummy_target] (/.test "" true)))]
@@ -209,10 +209,10 @@
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.for]
- (and (and (not (set.empty? (get@ #/.expected_coverage not_covering)))
- (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target))))
- (and (not (set.empty? (get@ #/.expected_coverage covering)))
- (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target))))))))
+ (and (and (not (set.empty? (value@ #/.expected_coverage not_covering)))
+ (not (set.member? (value@ #/.actual_coverage not_covering) (name_of ..dummy_target))))
+ (and (not (set.empty? (value@ #/.expected_coverage covering)))
+ (set.member? (value@ #/.actual_coverage covering) (name_of ..dummy_target))))))))
))
(def: .public test
@@ -239,10 +239,10 @@
(/.cover' [/.test]
(and (text.ends_with? expected_message/0 success_message)
(text.ends_with? expected_message/0 failure_message)
- (and (n.= 1 (get@ #/.successes success_tally))
- (n.= 0 (get@ #/.failures success_tally)))
- (and (n.= 0 (get@ #/.successes failure_tally))
- (n.= 1 (get@ #/.failures failure_tally))))))))
+ (and (n.= 1 (value@ #/.successes success_tally))
+ (n.= 0 (value@ #/.failures success_tally)))
+ (and (n.= 0 (value@ #/.successes failure_tally))
+ (n.= 1 (value@ #/.failures failure_tally))))))))
(do !
[tt (/.and (/.test expected_message/0 true)
(/.test expected_message/1 true))
@@ -273,18 +273,18 @@
(text.contains? expected_message/0 success_message))
(and (text.contains? expected_context failure_message)
(text.contains? expected_message/0 failure_message))
- (and (n.= 1 (get@ #/.successes success_tally))
- (n.= 0 (get@ #/.failures success_tally)))
- (and (n.= 0 (get@ #/.successes failure_tally))
- (n.= 1 (get@ #/.failures failure_tally))))))))
+ (and (n.= 1 (value@ #/.successes success_tally))
+ (n.= 0 (value@ #/.failures success_tally)))
+ (and (n.= 0 (value@ #/.successes failure_tally))
+ (n.= 1 (value@ #/.failures failure_tally))))))))
(do !
[failure_assertion (/.failure expected_message/0)]
(in (do async.monad
[[failure_tally failure_message] failure_assertion]
(/.cover' [/.failure]
(and (text.contains? expected_message/0 failure_message)
- (and (n.= 0 (get@ #/.successes failure_tally))
- (n.= 1 (get@ #/.failures failure_tally))))))))
+ (and (n.= 0 (value@ #/.successes failure_tally))
+ (n.= 1 (value@ #/.failures failure_tally))))))))
(do !
[success_assertion (/.lifted expected_message/0 (in true))
failure_assertion (/.lifted expected_message/0 (in false))]
@@ -294,10 +294,10 @@
(/.cover' [/.lifted]
(and (text.contains? expected_message/0 success_message)
(text.contains? expected_message/0 failure_message)
- (and (n.= 1 (get@ #/.successes success_tally))
- (n.= 0 (get@ #/.failures success_tally)))
- (and (n.= 0 (get@ #/.successes failure_tally))
- (n.= 1 (get@ #/.failures failure_tally))))))))
+ (and (n.= 1 (value@ #/.successes success_tally))
+ (n.= 0 (value@ #/.failures success_tally)))
+ (and (n.= 0 (value@ #/.successes failure_tally))
+ (n.= 1 (value@ #/.failures failure_tally))))))))
..times
..in_parallel
..coverage