From a4b64bf1cdf47160b6b615d2c6493039abfd7a94 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 28 Jul 2022 17:39:01 -0400 Subject: Extracted unit-testing machinery into its own module. --- stdlib/source/specification/aedifex/repository.lux | 9 +++--- .../specification/compositor/analysis/type.lux | 4 +-- .../specification/compositor/generation/case.lux | 14 ++++----- .../specification/compositor/generation/common.lux | 34 +++++++++++----------- .../compositor/generation/function.lux | 6 ++-- .../compositor/generation/primitive.lux | 2 +- .../compositor/generation/reference.lux | 4 +-- .../compositor/generation/structure.lux | 4 +-- stdlib/source/specification/lux/abstract/apply.lux | 8 ++--- stdlib/source/specification/lux/abstract/codec.lux | 2 +- .../source/specification/lux/abstract/comonad.lux | 6 ++-- stdlib/source/specification/lux/abstract/enum.lux | 2 +- .../specification/lux/abstract/equivalence.lux | 4 +-- .../source/specification/lux/abstract/functor.lux | 24 +++++++-------- .../lux/abstract/functor/contravariant.lux | 2 +- .../source/specification/lux/abstract/interval.lux | 4 +-- stdlib/source/specification/lux/abstract/monad.lux | 6 ++-- .../source/specification/lux/abstract/monoid.lux | 6 ++-- stdlib/source/specification/lux/abstract/order.lux | 4 +-- stdlib/source/specification/lux/world/console.lux | 7 +++-- .../source/specification/lux/world/environment.lux | 7 +++-- stdlib/source/specification/lux/world/file.lux | 29 +++++++++--------- stdlib/source/specification/lux/world/shell.lux | 15 +++++----- 23 files changed, 104 insertions(+), 99 deletions(-) (limited to 'stdlib/source/specification') diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux index 9cc2e0f2d..a0812b443 100644 --- a/stdlib/source/specification/aedifex/repository.lux +++ b/stdlib/source/specification/aedifex/repository.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -12,7 +11,9 @@ ["[0]" binary (.only) ["_[1]" \\test]]] [math - ["[0]" random]]]] + ["[0]" random]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\program ["[0]" / (.only) ["[1][0]" remote] @@ -27,7 +28,7 @@ (-> Artifact Artifact (/.Repository Async) Test) (do random.monad [expected (_binary.random 100)] - (in (all _.and' + (in (all unit.and (do async.monad [.let [good_uri (/remote.uri (the //artifact.#version valid_artifact) valid_artifact //artifact/extension.lux_library)] good_upload! (at subject upload good_uri expected) @@ -36,7 +37,7 @@ .let [bad_uri (/remote.uri (the //artifact.#version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] bad_upload! (at subject upload bad_uri expected) bad_download! (at subject download bad_uri)] - (_.coverage' [/.Repository] + (unit.coverage [/.Repository] (let [successfull_flow! (case [good_upload! good_download!] [{try.#Success _} {try.#Success actual}] diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux index 6675fad09..89ee8646f 100644 --- a/stdlib/source/specification/compositor/analysis/type.lux +++ b/stdlib/source/specification/compositor/analysis/type.lux @@ -56,8 +56,8 @@ [[typeC exprT exprC] ..check [other_typeC other_exprT other_exprC] ..check] (all _.and - (_.property "lux check" + (_.test "lux check" (check_success+ expander state "lux check" (list typeC exprC) exprT)) - (_.property "lux coerce" + (_.test "lux coerce" (check_success+ expander state "lux coerce" (list typeC other_exprC) exprT)) ))) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 5e00820b2..6ac785a12 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -101,7 +101,7 @@ (-> Runner Test) (do r.monad [value r.safe_frac] - (_.property (%.symbol (symbol synthesis.branch/let)) + (_.test (%.symbol (symbol synthesis.branch/let)) (|> (synthesis.branch/let [(synthesis.f64 value) 0 (synthesis.variable/local 0)]) @@ -114,7 +114,7 @@ [on_true r.safe_frac on_false (|> r.safe_frac (r.only (|>> (f.= on_true) not))) verdict r.bit] - (_.property (%.symbol (symbol synthesis.branch/if)) + (_.test (%.symbol (symbol synthesis.branch/if)) (|> (synthesis.branch/if [(synthesis.bit verdict) (synthesis.f64 on_true) (synthesis.f64 on_false)]) @@ -127,7 +127,7 @@ [[inputS pathS] ..case on_success r.safe_frac on_failure (|> r.safe_frac (r.only (|>> (f.= on_success) not)))] - (_.property (%.symbol (symbol synthesis.branch/case)) + (_.test (%.symbol (symbol synthesis.branch/case)) (|> (synthesis.branch/case [inputS (all synthesis.path/alt @@ -243,11 +243,11 @@ (def (special_spec run) (-> Runner Test) (all _.and - (_.property "===" + (_.test "===" (and (text#= (synthesis.%path special_path) (synthesis.%path special_pattern_path)) (at synthesis.path_equivalence = special_path special_pattern_path))) - (_.property "CODE" + (_.test "CODE" (|> special_input (run "special_input") (pipe.case @@ -256,7 +256,7 @@ {try.#Failure _} false))) - (_.property "PATTERN_MATCHING 0" + (_.test "PATTERN_MATCHING 0" (|> (synthesis.branch/case [special_input special_path]) (run "special_path") @@ -266,7 +266,7 @@ {try.#Failure _} false))) - (_.property "PATTERN_MATCHING 1" + (_.test "PATTERN_MATCHING 1" (|> (synthesis.branch/case [special_input special_pattern_path]) (run "special_pattern_path") diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index eb1a1ac70..ba691bde7 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -40,7 +40,7 @@ [param r.i64 subject r.i64] (with_expansions [ (with_template [ ] - [(_.property + [(_.test (|> {synthesis.#Extension (list (synthesis.i64 param) (synthesis.i64 subject))} (run (..safe )) @@ -60,7 +60,7 @@ )] (all _.and - (_.property "lux i64 arithmetic-right-shift" + (_.test "lux i64 arithmetic-right-shift" (|> {synthesis.#Extension "lux i64 arithmetic-right-shift" (list (synthesis.i64 subject) (synthesis.i64 param))} @@ -83,7 +83,7 @@ subject r.i64] (`` (all _.and (,, (with_template [ ] - [(_.property + [(_.test (|> {synthesis.#Extension (list (synthesis.i64 subject))} (run (..safe )) (pipe.case @@ -101,7 +101,7 @@ (as Int))] )) (,, (with_template [ ] - [(_.property + [(_.test (|> {synthesis.#Extension (list (synthesis.i64 param) (synthesis.i64 subject))} (run (..safe )) @@ -133,7 +133,7 @@ subject ..simple_frac] (`` (all _.and (,, (with_template [ ] - [(_.property + [(_.test (|> {synthesis.#Extension (list (synthesis.f64 param) (synthesis.f64 subject))} (run (..safe )) @@ -146,7 +146,7 @@ ["lux f64 %" f.% f.=] )) (,, (with_template [ ] - [(_.property + [(_.test (|> {synthesis.#Extension (list (synthesis.f64 param) (synthesis.f64 subject))} (run (..safe )) @@ -162,7 +162,7 @@ ["lux f64 <" f.<] )) (,, (with_template [ ] - [(_.property + [(_.test (|> {synthesis.#Extension (list)} (run (..safe )) (//case.verify )))] @@ -171,7 +171,7 @@ ["lux f64 max" ("lux f64 max")] ["lux f64 smallest" ("lux f64 smallest")] )) - (_.property "'lux f64 i64 && 'lux i64 f64'" + (_.test "'lux f64 i64 && 'lux i64 f64'" (|> (run (..safe "lux f64 i64") (|> subject synthesis.f64 (list) {synthesis.#Extension "lux f64 i64"} @@ -197,7 +197,7 @@ pre_rep_all (|> sample_lower (list.repeated sample_size) (text.interposed sample_upper)) post_rep_all (|> sample_lower (list.repeated sample_size) (text.interposed sample_alpha))]] (all _.and - (_.property "Can compare texts for equality." + (_.test "Can compare texts for equality." (and (|> {synthesis.#Extension "lux text =" (list sample_lowerS sample_lowerS)} (run (..safe "lux text =")) (pipe.case @@ -214,7 +214,7 @@ _ false)))) - (_.property "Can compare texts for order." + (_.test "Can compare texts for order." (|> {synthesis.#Extension "lux text <" (list sample_lowerS sample_upperS)} (run (..safe "lux text <")) (pipe.case @@ -223,7 +223,7 @@ {try.#Failure _} false))) - (_.property "Can get length of text." + (_.test "Can get length of text." (|> {synthesis.#Extension "lux text size" (list sample_lowerS)} (run (..safe "lux text size")) (pipe.case @@ -232,7 +232,7 @@ _ false))) - (_.property "Can concatenate text." + (_.test "Can concatenate text." (|> {synthesis.#Extension "lux text size" (list concatenatedS)} (run (..safe "lux text size")) (pipe.case @@ -241,7 +241,7 @@ _ false))) - (_.property "Can find index of sub-text." + (_.test "Can find index of sub-text." (and (|> {synthesis.#Extension "lux text index" (list concatenatedS sample_lowerS (synthesis.i64 +0))} @@ -281,10 +281,10 @@ _ false))))] - (_.property "Can clip text to extract sub-text." + (_.test "Can clip text to extract sub-text." (and (test_clip 0 sample_size sample_lower) (test_clip sample_size sample_size sample_upper)))) - (_.property "Can extract individual characters from text." + (_.test "Can extract individual characters from text." (|> {synthesis.#Extension "lux text char" (list sample_lowerS (synthesis.i64 char_idx))} @@ -305,7 +305,7 @@ (do r.monad [message (r.alphabetic 5)] (all _.and - (_.property "Can log messages." + (_.test "Can log messages." (|> {synthesis.#Extension "lux io log" (list (synthesis.text (format "LOG: " message)))} (run (..safe "lux io log")) @@ -315,7 +315,7 @@ {try.#Failure _} false))) - (_.property "Can throw runtime errors." + (_.test "Can throw runtime errors." (and (|> {synthesis.#Extension "lux try" (list (synthesis.function/abstraction [synthesis.#environment (list) diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index 7fc24cfb8..2fb9714e0 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -55,12 +55,12 @@ .let [expectation (maybe.trusted (list.item (-- local) inputs)) inputsS (list#each (|>> synthesis.f64) inputs)]] (all _.and - (_.property "Can read arguments." + (_.test "Can read arguments." (|> (synthesis.function/apply [synthesis.#function functionS synthesis.#arguments inputsS]) (run "with_local") (//case.verify expectation))) - (_.property "Can partially apply functions." + (_.test "Can partially apply functions." (or (n.= 1 arity) (let [preS (list.first partial_arity inputsS) postS (list.after partial_arity inputsS) @@ -70,7 +70,7 @@ synthesis.#arguments postS]) (run "partial_application") (//case.verify expectation))))) - (_.property "Can read environment." + (_.test "Can read environment." (or (n.= 1 arity) (let [environment (|> partial_arity (enum.range n.enum 1) diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index 9e6ea2e02..fcb6bd050 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -32,7 +32,7 @@ (,, (with_template [ ] [(do r.monad [expected ] - (_.property (%.symbol (symbol )) + (_.test (%.symbol (symbol )) (|> (run ( expected)) (pipe.case {try.#Success actual} diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index 7159afe1b..27441f349 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -29,7 +29,7 @@ (do r.monad [name ..symbol expected r.safe_frac] - (_.property "Definitions." + (_.test "Definitions." (|> (define name (synthesis.f64 expected)) (pipe.case {try.#Success actual} @@ -43,7 +43,7 @@ (do [! r.monad] [register (|> r.nat (at ! each (n.% 100))) expected r.safe_frac] - (_.property "Local variables." + (_.test "Local variables." (|> (synthesis.branch/let [(synthesis.f64 expected) register (synthesis.variable/local register)]) diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index 523ad990e..5521c6303 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -35,7 +35,7 @@ tag_in (|> r.nat (at ! each (n.% num_tags))) .let [last?_in (|> num_tags -- (n.= tag_in))] value_in r.i64] - (_.property (%.symbol (symbol synthesis.variant)) + (_.test (%.symbol (symbol synthesis.variant)) (|> (synthesis.variant [analysis.#lefts (if last?_in (-- tag_in) tag_in) @@ -69,7 +69,7 @@ (do [! r.monad] [size (|> r.nat (at ! each (|>> (n.% 10) (n.max 2)))) tuple_in (r.list size r.i64)] - (_.property (%.symbol (symbol synthesis.tuple)) + (_.test (%.symbol (symbol synthesis.tuple)) (|> (synthesis.tuple (list#each (|>> synthesis.i64) tuple_in)) (run "tuple") (pipe.case diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux index 9c29ed974..460469078 100644 --- a/stdlib/source/specification/lux/abstract/apply.lux +++ b/stdlib/source/specification/lux/abstract/apply.lux @@ -21,7 +21,7 @@ (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) (do [! random.monad] [sample (at ! each injection random.nat)] - (_.property "Identity." + (_.test "Identity." ((comparison n.=) (/#on sample (injection function.identity)) sample)))) @@ -31,7 +31,7 @@ (do [! random.monad] [sample random.nat increase (at ! each n.+ random.nat)] - (_.property "Homomorphism." + (_.test "Homomorphism." ((comparison n.=) (/#on (injection sample) (injection increase)) (injection (increase sample)))))) @@ -41,7 +41,7 @@ (do [! random.monad] [sample random.nat increase (at ! each n.+ random.nat)] - (_.property "Interchange." + (_.test "Interchange." ((comparison n.=) (/#on (injection sample) (injection increase)) (/#on (injection increase) (injection (is (-> (-> Nat Nat) Nat) @@ -56,7 +56,7 @@ (at ! each n.+ random.nat)) decrease (is (Random :$/1:) (at ! each n.- random.nat))] - (_.property "Composition." + (_.test "Composition." ((comparison n.=) (|> (injection (is (-> :$/1: :$/1: :$/1:) function.composite)) diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux index acbc07647..7ed8612b1 100644 --- a/stdlib/source/specification/lux/abstract/codec.lux +++ b/stdlib/source/specification/lux/abstract/codec.lux @@ -18,7 +18,7 @@ (do random.monad [expected generator] (_.for [/.Codec] - (_.property "Isomorphism." + (_.test "Isomorphism." (case (|> expected @//encoded @//decoded) {try.#Success actual} (@//= expected actual) diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux index 897c29f06..9bd0ec336 100644 --- a/stdlib/source/specification/lux/abstract/comonad.lux +++ b/stdlib/source/specification/lux/abstract/comonad.lux @@ -21,7 +21,7 @@ (|>> _//out (n.+ diff))) random.nat) .let [start (injection sample)]] - (_.property "Left identity." + (_.test "Left identity." (n.= (morphism start) (|> start _//disjoint (_//each morphism) _//out))))) @@ -31,7 +31,7 @@ [sample random.nat .let [start (injection sample) == (comparison n.=)]] - (_.property "Right identity." + (_.test "Right identity." (== start (|> start _//disjoint (_//each _//out)))))) @@ -47,7 +47,7 @@ random.nat) .let [start (injection sample) == (comparison n.=)]] - (_.property "Associativity." + (_.test "Associativity." (== (|> start _//disjoint (_//each (|>> _//disjoint (_//each increase) decrease))) (|> start _//disjoint (_//each increase) _//disjoint (_//each decrease)))))) diff --git a/stdlib/source/specification/lux/abstract/enum.lux b/stdlib/source/specification/lux/abstract/enum.lux index a1cf2820e..84cd03321 100644 --- a/stdlib/source/specification/lux/abstract/enum.lux +++ b/stdlib/source/specification/lux/abstract/enum.lux @@ -15,7 +15,7 @@ [sample gen_sample] (<| (_.for [/.Enum]) (all _.and - (_.property "Successor and predecessor are inverse functions." + (_.test "Successor and predecessor are inverse functions." (and (_#= (|> sample _#succ _#pred) sample) (_#= (|> sample _#pred _#succ) diff --git a/stdlib/source/specification/lux/abstract/equivalence.lux b/stdlib/source/specification/lux/abstract/equivalence.lux index b2b643d4f..215a015fe 100644 --- a/stdlib/source/specification/lux/abstract/equivalence.lux +++ b/stdlib/source/specification/lux/abstract/equivalence.lux @@ -18,7 +18,7 @@ right random] (<| (_.for [/.Equivalence]) (all _.and - (_.property "Reflexivity" + (_.test "Reflexivity" (/#= left left)) - (_.property "Symmetry" + (_.test "Symmetry" (bit#= (/#= left right) (/#= right left))))))) diff --git a/stdlib/source/specification/lux/abstract/functor.lux b/stdlib/source/specification/lux/abstract/functor.lux index e1be8eba2..383037e9e 100644 --- a/stdlib/source/specification/lux/abstract/functor.lux +++ b/stdlib/source/specification/lux/abstract/functor.lux @@ -26,20 +26,20 @@ (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (do [! random.monad] [sample (at ! each injection random.nat)] - (_.property "Identity." - ((comparison n.=) - (@//each function.identity sample) - sample)))) + (_.test "Identity." + ((comparison n.=) + (@//each function.identity sample) + sample)))) (def (homomorphism injection comparison (open "@//[0]")) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (do [! random.monad] [sample random.nat increase (at ! each n.+ random.nat)] - (_.property "Homomorphism." - ((comparison n.=) - (@//each increase (injection sample)) - (injection (increase sample)))))) + (_.test "Homomorphism." + ((comparison n.=) + (@//each increase (injection sample)) + (injection (increase sample)))))) (def (composition injection comparison (open "@//[0]")) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) @@ -47,10 +47,10 @@ [sample (at ! each injection random.nat) increase (at ! each n.+ random.nat) decrease (at ! each n.- random.nat)] - (_.property "Composition." - ((comparison n.=) - (|> sample (@//each increase) (@//each decrease)) - (|> sample (@//each (|>> increase decrease))))))) + (_.test "Composition." + ((comparison n.=) + (|> sample (@//each increase) (@//each decrease)) + (|> sample (@//each (|>> increase decrease))))))) (def .public (spec injection comparison functor) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) diff --git a/stdlib/source/specification/lux/abstract/functor/contravariant.lux b/stdlib/source/specification/lux/abstract/functor/contravariant.lux index 6099ce42a..3f02e35c8 100644 --- a/stdlib/source/specification/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/specification/lux/abstract/functor/contravariant.lux @@ -16,7 +16,7 @@ (def (identity equivalence value (open "@//[0]")) (All (_ f a) (-> (Equivalence (f a)) (f a) (Functor f) Test)) - (_.property "Law of identity." + (_.test "Law of identity." (equivalence (@//each function.identity value) value))) diff --git a/stdlib/source/specification/lux/abstract/interval.lux b/stdlib/source/specification/lux/abstract/interval.lux index e0a012e9b..51688e4ce 100644 --- a/stdlib/source/specification/lux/abstract/interval.lux +++ b/stdlib/source/specification/lux/abstract/interval.lux @@ -16,8 +16,8 @@ (do random.monad [sample gen_sample] (all _.and - (_.property "No value is bigger than the top." + (_.test "No value is bigger than the top." (@//< @//top sample)) - (_.property "No value is smaller than the bottom." + (_.test "No value is smaller than the bottom." (order.> @//order @//bottom sample)) )))) diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux index e95ddf67d..3613a3214 100644 --- a/stdlib/source/specification/lux/abstract/monad.lux +++ b/stdlib/source/specification/lux/abstract/monad.lux @@ -18,7 +18,7 @@ morphism (at ! each (function (_ diff) (|>> (n.+ diff) _//in)) random.nat)] - (_.property "Left identity." + (_.test "Left identity." ((comparison n.=) (|> (injection sample) (_//each morphism) _//conjoint) (morphism sample))))) @@ -27,7 +27,7 @@ (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) (do random.monad [sample random.nat] - (_.property "Right identity." + (_.test "Right identity." ((comparison n.=) (|> (injection sample) (_//each _//in) _//conjoint) (injection sample))))) @@ -42,7 +42,7 @@ decrease (at ! each (function (_ diff) (|>> (n.- diff) _//in)) random.nat)] - (_.property "Associativity." + (_.test "Associativity." ((comparison n.=) (|> (injection sample) (_//each increase) _//conjoint (_//each decrease) _//conjoint) (|> (injection sample) (_//each (|>> increase (_//each decrease) _//conjoint)) _//conjoint))))) diff --git a/stdlib/source/specification/lux/abstract/monoid.lux b/stdlib/source/specification/lux/abstract/monoid.lux index dedaca77b..78f387f5f 100644 --- a/stdlib/source/specification/lux/abstract/monoid.lux +++ b/stdlib/source/specification/lux/abstract/monoid.lux @@ -20,13 +20,13 @@ right gen_sample] (<| (_.for [/.Monoid]) (all _.and - (_.property "Left identity." + (_.test "Left identity." (_#= sample (_#composite _#identity sample))) - (_.property "Right identity." + (_.test "Right identity." (_#= sample (_#composite sample _#identity))) - (_.property "Associativity." + (_.test "Associativity." (_#= (_#composite left (_#composite mid right)) (_#composite (_#composite left mid) right))) )))) diff --git a/stdlib/source/specification/lux/abstract/order.lux b/stdlib/source/specification/lux/abstract/order.lux index 4d448c958..3ec435fb8 100644 --- a/stdlib/source/specification/lux/abstract/order.lux +++ b/stdlib/source/specification/lux/abstract/order.lux @@ -16,7 +16,7 @@ (do random.monad [parameter generator subject generator] - (_.property "Values are either ordered, or they are equal. All options(_ are mutually exclusive." + (_.test "Values are either ordered, or they are equal. All options(_ are mutually exclusive." (cond (@//< parameter subject) (not (or (@//< subject parameter) (@//= parameter subject))) @@ -34,7 +34,7 @@ (not (or (@//= parameter value) (@//= subject value)))) generator)] - (_.property "Transitive property." + (_.test "Transitive property." (if (@//< parameter subject) (let [greater? (and (@//< subject extra) (@//< parameter extra)) diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux index 78953c351..cb17b4338 100644 --- a/stdlib/source/specification/lux/world/console.lux +++ b/stdlib/source/specification/lux/world/console.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -13,7 +12,9 @@ ["[0]" text (.only) ["%" \\format (.only format)]]] [math - ["[0]" random]]]] + ["[0]" random]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -52,7 +53,7 @@ _ false)]] - (_.coverage' [/.Console] + (unit.coverage [/.Console] (and can_write! can_read! can_close!)))))) diff --git a/stdlib/source/specification/lux/world/environment.lux b/stdlib/source/specification/lux/world/environment.lux index 2163fc2e1..fb6600bfe 100644 --- a/stdlib/source/specification/lux/world/environment.lux +++ b/stdlib/source/specification/lux/world/environment.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -14,7 +13,9 @@ ["[0]" dictionary] ["[0]" list]]] [math - ["[0]" random]]]] + ["[0]" random]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -24,7 +25,7 @@ [exit random.int] (in (do [! async.monad] [environment (/.environment ! subject)] - (_.coverage' [/.Environment] + (unit.coverage [/.Environment] (and (not (dictionary.empty? environment)) (list.every? (|>> text.empty? not) (dictionary.keys environment)) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index dc6cb6528..0f642d2aa 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -28,7 +27,9 @@ ["n" nat]]] [world [time - ["[0]" instant (.only Instant) (.use "[1]#[0]" equivalence)]]]]] + ["[0]" instant (.only Instant) (.use "[1]#[0]" equivalence)]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -41,17 +42,17 @@ in (do async.monad [fs (async.future fs)] - (all _.and' - (_.coverage' [/.rooted] + (all unit.and + (unit.coverage [/.rooted] (let [path (/.rooted fs parent child)] (and (text.starts_with? parent path) (text.ends_with? child path)))) - (_.coverage' [/.parent] + (unit.coverage [/.parent] (|> (/.rooted fs parent child) (/.parent fs) (maybe#each (text#= parent)) (maybe.else false))) - (_.coverage' [/.name] + (unit.coverage [/.name] (|> (/.rooted fs parent child) (/.name fs) (text#= child))) @@ -198,7 +199,7 @@ move&delete (..move&delete fs parent child alternate_child)]) - (_.coverage' [/.System] + (unit.coverage [/.System] (and directory?&make_directory file?&write file_size&read&append @@ -228,8 +229,8 @@ cannot_make_directory!/0 (/.make_directories ! fs "") cannot_make_directory!/1 (/.make_directories ! fs (at fs separator))]) - (all _.and' - (_.coverage' [/.make_directories] + (all unit.and + (unit.coverage [/.make_directories] (and (not pre_dir/0) (not pre_dir/1) (not pre_dir/2) @@ -239,7 +240,7 @@ post_dir/0 post_dir/1 post_dir/2)) - (_.coverage' [/.cannot_make_directory] + (unit.coverage [/.cannot_make_directory] (and (case cannot_make_directory!/0 {try.#Success _} false @@ -263,12 +264,12 @@ [fs (async.future fs) make_file!/0 (/.make_file ! fs (utf8#encoded file/0) file/0) make_file!/1 (/.make_file ! fs (utf8#encoded file/0) file/0)]) - (all _.and' - (_.coverage' [/.make_file] + (all unit.and + (unit.coverage [/.make_file] (case make_file!/0 {try.#Success _} true {try.#Failure error} false)) - (_.coverage' [/.cannot_make_file] + (unit.coverage [/.cannot_make_file] (case make_file!/1 {try.#Success _} false @@ -306,7 +307,7 @@ post_file/1 (/.exists? ! fs file) post_dir/0 (at fs directory? dir) post_dir/1 (/.exists? ! fs dir)]) - (_.coverage' [/.exists?] + (unit.coverage [/.exists?] (and (not pre_file/0) (not pre_file/1) (not pre_dir/0) diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux index ddf544c55..bf507b536 100644 --- a/stdlib/source/specification/lux/world/shell.lux +++ b/stdlib/source/specification/lux/world/shell.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -16,7 +15,9 @@ ["[0]" random] [number ["n" nat] - ["i" int]]]]] + ["i" int]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -34,11 +35,11 @@ ) (def (can_wait! process) - (-> (/.Process Async) _.Assertion) + (-> (/.Process Async) unit.Test) (|> (at process await []) (async#each (|>> (try#each (i.= /.normal)) (try.else false) - (_.coverage' [/.Exit /.normal]))) + (unit.coverage [/.Exit /.normal]))) async#conjoint)) (def (can_read! expected process) @@ -80,13 +81,13 @@ (do ! [can_read! (..can_read! message echo) can_destroy! (..can_destroy! sleep)] - (all _.and' - (_.coverage' + (all unit.and + (unit.coverage (and can_read! can_destroy!)) (..can_wait! echo) )) _ - (_.coverage' + (unit.coverage false)))))))) -- cgit v1.2.3