diff options
author | Eduardo Julian | 2022-12-19 20:56:06 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-12-19 20:56:06 -0400 |
commit | 240a4465157bb903dd2a3ee4cdc28aadf09f8dcb (patch) | |
tree | 018925b984a788afdd343262010041492978394c /stdlib | |
parent | c2830c26e55da02ac628be9a220cd824264cdc9e (diff) |
Added price-action abstraction.
Diffstat (limited to 'stdlib')
85 files changed, 1033 insertions, 619 deletions
diff --git a/stdlib/source/documentation/lux/meta/type/poly.lux b/stdlib/source/documentation/lux/meta/type/poly.lux index b781bb5c8..79ffafeba 100644 --- a/stdlib/source/documentation/lux/meta/type/poly.lux +++ b/stdlib/source/documentation/lux/meta/type/poly.lux @@ -2,10 +2,6 @@ [library [lux (.except) ["$" documentation] - [abstract - [\\specification - ["$[0]" equivalence] - ["$[0]" codec]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]]]] diff --git a/stdlib/source/library/lux/math/arithmetic.lux b/stdlib/source/library/lux/math/arithmetic.lux index 46488890a..cad6653c7 100644 --- a/stdlib/source/library/lux/math/arithmetic.lux +++ b/stdlib/source/library/lux/math/arithmetic.lux @@ -16,7 +16,4 @@ *) (is (-> of of of) - /) - (is (-> of of - of) - %))) + /))) diff --git a/stdlib/source/library/lux/math/arithmetic/fixed_point.lux b/stdlib/source/library/lux/math/arithmetic/fixed_point.lux index 717d4261e..db7e4102b 100644 --- a/stdlib/source/library/lux/math/arithmetic/fixed_point.lux +++ b/stdlib/source/library/lux/math/arithmetic/fixed_point.lux @@ -174,7 +174,6 @@ (def - (..- @)) (def * (..* @)) (def / (../ @)) - (def % (..% @)) )) (def .public (format @ it) diff --git a/stdlib/source/library/lux/math/arithmetic/saturation.lux b/stdlib/source/library/lux/math/arithmetic/saturation.lux index cb72169ce..4ded512df 100644 --- a/stdlib/source/library/lux/math/arithmetic/saturation.lux +++ b/stdlib/source/library/lux/math/arithmetic/saturation.lux @@ -22,5 +22,4 @@ [-] [*] [/] - [%] )))))) diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux index 518da2518..4a435c693 100644 --- a/stdlib/source/library/lux/math/number/complex.lux +++ b/stdlib/source/library/lux/math/number/complex.lux @@ -154,8 +154,7 @@ (def + ..+) (def - ..-) (def * ..*) - (def / ../) - (def % ..%))) + (def / ../))) (def .public (cos subject) (-> Complex diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index b6c4f3f20..6dcac2a10 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -520,8 +520,7 @@ (def + ..+) (def - ..-) (def * ..*) - (def / ../) - (def % ..%))) + (def / ../))) (def .public (/% param subject) (-> Frac Frac diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux index 4f588d46b..3fc667291 100644 --- a/stdlib/source/library/lux/math/number/i32.lux +++ b/stdlib/source/library/lux/math/number/i32.lux @@ -8,6 +8,7 @@ ["[0]" maybe] ["[0]" try]] [meta + ["@" target] ["[0]" static] ["[0]" type (.only) ["?[1]" \\parser]]]]] @@ -17,12 +18,23 @@ (def sub (maybe.trusted (i64.sub 32))) -(`` (type .public I32 - (I64 (,, (|> (type_of ..sub) - (?type.result (?type.applied (?.after (?type.exactly i64.Sub) - ?type.any))) - try.trusted - (static.literal type.code)))))) +(for @.old + (def .public I32 + Type + (when (type_of ..sub) + {.#Apply :size: :sub:} + (type_literal (I64 :size:)) + + _ + (undefined))) + + (`` (type .public I32 + (I64 (,, (|> (type_of ..sub) + (?type.result (?type.applied (?.after (?type.exactly i64.Sub) + ?type.any))) + try.trusted + (static.literal type.code)))))) + ) (def .public equivalence (Equivalence I32) (of ..sub sub_equivalence)) (def .public width Nat (of ..sub bits)) diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index fb1cb1912..6e91de08b 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -90,8 +90,7 @@ (def + ..+) (def - ..-) (def * ..*) - (def / ../) - (def % ..%))) + (def / ../))) (def .public (/% param subject) (-> Int Int diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index d60d2c191..62b807133 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -125,8 +125,7 @@ (def + ..+) (def - ..-) (def * ..*) - (def / ../) - (def % ..%))) + (def / ../))) (def .public (gcd a b) (-> Nat Nat diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index f24598300..4877d65da 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -144,8 +144,7 @@ (def + ..+) (def - ..-) (def * ..*) - (def / ../) - (def % ..%))) + (def / ../))) (def .public (reciprocal (open "_[0]")) (-> Ratio diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index 16e8cc8f1..0cb32bf12 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -171,8 +171,7 @@ (def + ..+) (def - ..-) (def * ..*) - (def / ../) - (def % ..%))) + (def / ../))) (with_template [<operator> <name>] [(def .public (<name> scale subject) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux index 657ad6024..420daefdb 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -69,6 +69,7 @@ ["[0]" function ["[1]" abstract]]]] ["/[1]" // + ["[0]" phase (.use "[1]#[0]" monad)] ["[0]" translation] ["[0]" declaration] ["[1][0]" analysis (.only Analysis Operation Phase Handler Bundle) @@ -78,7 +79,6 @@ ["[0]A" type] ["[0]" scope]] [/// - ["[0]" phase (.use "[1]#[0]" monad)] ["[0]" reference (.only) ["[0]" variable]] [meta diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux index 57a55392d..c99eb4832 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux @@ -54,7 +54,6 @@ ["[0]" descriptor (.only Descriptor)] ["[0]" parser]]]] [compiler - ["[0]" phase] [reference [variable (.only Register)]] [meta @@ -73,7 +72,7 @@ ["[0]A" scope]] ["[0]" synthesis (.only Synthesis) ["<[1]>" \\parser]] - [phase + ["[0]" phase (.only) [translation [jvm ["[0]" runtime (.only Anchor Definition Extender)] diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux index bfbe24cd2..770614d0c 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux @@ -34,11 +34,11 @@ ["//[1]" /// ["[0]" extension] [// + ["[0]" phase (.use "[1]#[0]" monad)] ["[0]" synthesis (.only Synthesis)] ["[0]" translation] [/// - ["[0]" reference] - ["[0]" phase (.use "[1]#[0]" monad)]]]]]) + ["[0]" reference]]]]]) (def (with_source_mapping @ it) (All (_ of) diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux b/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux index f23c094b4..e0c90d2a8 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux @@ -11,10 +11,14 @@ Signature (def .public signature - (All (_ ?) (-> (Key ?) Signature)) + (All (_ of) + (-> (Key of) + Signature)) (|>> representation)) (def .public (key signature sample) - (All (_ d) (-> Signature d (Key d))) + (All (_ of) + (-> Signature of + (Key of))) (abstraction signature)) ) diff --git a/stdlib/source/library/lux/world/finance/market/price.lux b/stdlib/source/library/lux/world/finance/market/price.lux new file mode 100644 index 000000000..58c4216d8 --- /dev/null +++ b/stdlib/source/library/lux/world/finance/market/price.lux @@ -0,0 +1,151 @@ +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)] + ["[0]" order (.only Order)]] + [data + [text + ["%" \\format]]] + [math + [number + ["i" int]]] + [meta + [type + ["[0]" nominal]]]]] + [/// + [money (.only Money) + ["[0]" currency (.only Currency)]]]) + +(type .public (Price $) + (Money $)) + +... https://en.wikipedia.org/wiki/Price_action_trading +(nominal.def .public (Action $) + (Record + [#currency (Currency $) + #movement Int]) + + (def .public (action currency movement) + (All (_ $) + (-> (Currency $) Int + (Action $))) + (nominal.abstraction + [#currency currency + #movement movement])) + + (with_template [<*> <name>] + [(def .public (<name> currency it) + (All (_ $) + (-> (Currency $) Int + (Action $))) + (action currency + (<*> (.int (currency.sub_divisions currency)) + it)))] + + [i.* of_units] + [i.% of_sub_units] + ) + + (with_template [<name> <slot> <type>] + [(def .public <name> + (All (_ $) + (-> (Action $) + <type>)) + (|>> nominal.representation + (the <slot>)))] + + [currency #currency (Currency $)] + [movement #movement Int] + ) + + (def .public order + (All (_ $) + (Order (Action $))) + (of order.functor each + ..movement + i.order)) + + (def .public < + (All (_ $) + (-> (Action $) (Action $) + Bit)) + (of ..order <)) + + (with_template [<name> <order>] + [(def .public <name> + (All (_ $) + (-> (Action $) (Action $) + Bit)) + (<order> order))] + + [<= order.<=] + [> order.>] + [>= order.>=] + ) + + (def .public equivalence + (All (_ $) + (Equivalence (Action $))) + (of ..order equivalence)) + + (def .public = + (All (_ $) + (-> (Action $) (Action $) + Bit)) + (of ..equivalence =)) + + (with_template [<p> <i>] + [(def .public (<p> parameter subject) + (All (_ $) + (-> (Action $) (Action $) + (Action $))) + (let [parameter (nominal.representation parameter) + subject (nominal.representation subject)] + (nominal.abstraction + [#currency (the #currency subject) + #movement (<i> (the #movement parameter) + (the #movement subject))])))] + + [+ i.+] + [- i.-] + ) + + (def .public (format it) + (All (_ $) + (%.Format (Action $))) + (let [[currency movement] (nominal.representation it) + [macro micro] (i./% (.int (currency.sub_divisions currency)) + movement)] + (%.format (%.int macro) + (when micro + +0 "" + _ (%.format "." (%.nat (.nat micro)))) + " " (currency.alphabetic_code currency)))) + ) + +(with_template [<order> <name>] + [(def .public (<name> left right) + (All (_ $) + (-> (Action $) (Action $) + (Action $))) + (if (<order> (..movement left) + (..movement right)) + right + left))] + + [i.< min] + [i.> max] + ) + +(with_template [<*> <name>] + [(def .public (<name> it) + (All (_ $) + (-> (Action $) + Int)) + (<*> (.int (currency.sub_divisions (..currency it))) + (..movement it)))] + + [i./ units] + [i.% sub_units] + ) diff --git a/stdlib/source/library/lux/world/finance/money.lux b/stdlib/source/library/lux/world/finance/money.lux index cd0724459..a32f05943 100644 --- a/stdlib/source/library/lux/world/finance/money.lux +++ b/stdlib/source/library/lux/world/finance/money.lux @@ -31,15 +31,18 @@ [#currency currency #amount amount])) - (def .public (of_units currency it) - (All (_ currency) - (-> (/.Currency currency) Nat - (Money currency))) - (money currency - (n.* (/.sub_divisions currency) - it))) - - (def .public of_sub_units money) + (with_template [<*> <name>] + [(def .public (<name> currency it) + (All (_ currency) + (-> (/.Currency currency) Nat + (Money currency))) + (money currency + (<*> (/.sub_divisions currency) + it)))] + + [n.* of_units] + [n.% of_sub_units] + ) (with_template [<name> <slot> <type>] [(def .public <name> diff --git a/stdlib/source/library/lux/world/finance/trade/session.lux b/stdlib/source/library/lux/world/finance/trade/session.lux index 821135300..e9e3d5f4c 100644 --- a/stdlib/source/library/lux/world/finance/trade/session.lux +++ b/stdlib/source/library/lux/world/finance/trade/session.lux @@ -11,10 +11,9 @@ ["n" nat]]]]] [/// ["[0]" money (.only Money) - [currency (.only Currency)]]]) - -(type .public (Price $) - (Money $)) + [currency (.only Currency)]] + [market + [price (.only Price)]]]) (type .public Volume Nat) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index d6cd14da5..6b59e88ca 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -3,7 +3,7 @@ [lux (.except Module) ["[0]" debug] [abstract - ["[0]" monad (.only do)]] + ["[0]" monad (.only Monad do)]] [control ["[0]" io (.only IO io)] ["[0]" maybe] @@ -212,22 +212,32 @@ tar.set_user_id_on_execution )) +(type (Action of) + (Async (Try of))) + +(def monad + (is (Monad Action) + (as_expected (try.with async.monad)))) + +(def (cache_tar_entry fs path) + (-> (file.System Async) file.Path + (Action tar.Entry)) + (do async.monad + [content (of fs read path)] + (in (do try.monad + [content content + path (tar.path path) + content (tar.content content)] + (in {tar.#Normal [path instant.epoch ..cache_mode tar.no_ownership content]}))))) + (def (cache_tar context fs) (-> Context (file.System Async) - (Async (Try Tar))) + (Action Tar)) (loop (again [root (cache.path fs context)]) - (do [! (try.with async.monad)] + (do [! ..monad] [files (of fs directory_files root) subs (of fs sub_directories root) - files (monad.each ! (function (_ path) - (do ! - [content (of fs read path) - [path content] (async#in (do try.monad - [path (tar.path path) - content (tar.content content)] - (in [path content])))] - (in {tar.#Normal [path instant.epoch ..cache_mode tar.no_ownership content]}))) - files) + files (monad.each ! (cache_tar_entry fs) files) subs (monad.each ! again subs)] (in (list#mix sequence#composite (sequence.of_list files) diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux deleted file mode 100644 index e4e9d3bed..000000000 --- a/stdlib/source/specification/lux/abstract/codec.lux +++ /dev/null @@ -1,28 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [monad (.only do)]] - [control - ["[0]" try]] - [math - ["[0]" random (.only Random)]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only) - [// - [equivalence (.only Equivalence)]]]]) - -(def .public (spec (open "/#[0]") (open "/#[0]") generator) - (All (_ m a) (-> (Equivalence a) (/.Codec m a) (Random a) Test)) - (do random.monad - [expected generator] - (_.for [/.Codec] - (_.coverage [/.encoded /.decoded] - (when (|> expected /#encoded /#decoded) - {try.#Success actual} - (/#= expected actual) - - {try.#Failure _} - false))))) diff --git a/stdlib/source/specification/lux/abstract/enum.lux b/stdlib/source/specification/lux/abstract/enum.lux index 569e67181..0d367f7c0 100644 --- a/stdlib/source/specification/lux/abstract/enum.lux +++ b/stdlib/source/specification/lux/abstract/enum.lux @@ -2,15 +2,15 @@ [library [lux (.except) [abstract - [monad (.only do)]] + [monad (.only do)] + ["[0]" order + ["[1]T" \\test]]] [math ["[0]" random (.only Random)]] [test ["_" property (.only Test)]]]] [\\library - ["[0]" /]] - [// - ["[0]S" order]]) + ["[0]" /]]) (def .public (spec (open "/#[0]") random) (All (_ a) (-> (/.Enum a) (Random a) Test)) @@ -19,7 +19,7 @@ (<| (_.for [/.Enum]) (all _.and (_.for [/.order] - (orderS.spec /#order random)) + (orderT.spec /#order random)) (_.coverage [/.succ /.pred] (and (/#= (|> sample /#succ /#pred) sample) diff --git a/stdlib/source/specification/lux/abstract/functor/contravariant.lux b/stdlib/source/specification/lux/abstract/functor/contravariant.lux deleted file mode 100644 index aa7d63d43..000000000 --- a/stdlib/source/specification/lux/abstract/functor/contravariant.lux +++ /dev/null @@ -1,32 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [equivalence (.only Equivalence)] - [monad (.only do)]] - [control - ["[0]" function]] - [math - ["[0]" random] - [number - ["n" nat]]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only Functor)]]) - -(def (identity equivalence value (open "@//[0]")) - (All (_ f a) (-> (Equivalence (f a)) (f a) (Functor f) Test)) - (_.test "Law of identity." - (equivalence - (@//each function.identity value) - value))) - -(def .public (spec equivalence value functor) - (All (_ f a) (-> (Equivalence (f a)) (f a) (Functor f) Test)) - (do random.monad - [sample random.nat] - (<| (_.for [/.Functor]) - (all _.and - (..identity equivalence value functor) - )))) diff --git a/stdlib/source/specification/lux/abstract/monoid.lux b/stdlib/source/specification/lux/abstract/monoid.lux deleted file mode 100644 index fe69e9f6b..000000000 --- a/stdlib/source/specification/lux/abstract/monoid.lux +++ /dev/null @@ -1,33 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [monad (.only do)]] - [math - ["[0]" random (.only Random)]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only) - [// - [equivalence (.only Equivalence)]]]]) - -(def .public (spec (open "_#[0]") (open "_#[0]") gen_sample) - (All (_ a) (-> (Equivalence a) (/.Monoid a) (Random a) Test)) - (do random.monad - [sample gen_sample - left gen_sample - mid gen_sample - right gen_sample] - (<| (_.for [/.Monoid]) - (all _.and - (_.test "Left identity." - (_#= sample - (_#composite _#identity sample))) - (_.test "Right identity." - (_#= sample - (_#composite sample _#identity))) - (_.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 deleted file mode 100644 index 1bf62b3cc..000000000 --- a/stdlib/source/specification/lux/abstract/order.lux +++ /dev/null @@ -1,70 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [monad (.only do)]] - [data - ["[0]" bit (.use "[1]#[0]" equivalence)]] - [math - ["[0]" random (.only Random)]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" /]] - [// - ["[0]S" equivalence]]) - -(def .public (spec (open "/#[0]") random) - (All (_ of) - (-> (/.Order of) (Random of) - Test)) - (<| (_.for [/.Order]) - (all _.and - (_.for [/.equivalence] - (equivalenceS.spec /#equivalence random)) - - (do random.monad - [parameter random - subject random - .let [equal_or_ordered! - (let [equal! - (/#= parameter subject) - - ordered! - (or (and (/#< parameter subject) - (not (/#< subject parameter))) - (and (/#< subject parameter) - (not (/#< parameter subject))))] - (bit#= equal! (not ordered!)))] - - subject (random.only (|>> (/#= parameter) not) - random) - extra (random.only (function (_ value) - (not (or (/#= parameter value) - (/#= subject value)))) - random) - .let [transitive_property! - (if (/#< parameter subject) - (let [greater? (and (/#< subject extra) - (/#< parameter extra)) - lesser? (and (/#< extra parameter) - (/#< extra subject)) - in_between? (and (/#< parameter extra) - (/#< extra subject))] - (or greater? - lesser? - in_between?)) - ... (/#< subject parameter) - (let [greater? (and (/#< extra subject) - (/#< extra parameter)) - lesser? (and (/#< parameter extra) - (/#< subject extra)) - in_between? (and (/#< subject extra) - (/#< extra parameter))] - (or greater? - lesser? - in_between?)))]] - (_.coverage [/.<] - (and equal_or_ordered! - transitive_property!))) - ))) diff --git a/stdlib/source/specification/lux/math/arithmetic.lux b/stdlib/source/specification/lux/math/arithmetic.lux index 7ae9f3f06..9b8d1fb7d 100644 --- a/stdlib/source/specification/lux/math/arithmetic.lux +++ b/stdlib/source/specification/lux/math/arithmetic.lux @@ -38,9 +38,4 @@ (|> left (/ one) (= left)) (|> left (/ left) (= one)) (|> left (* zero) (= zero)))) - (_.coverage [/.%] - (let [rem (% left right) - div (|> right (- rem) (/ left))] - (= right - (|> div (* left) (+ rem))))) )))) diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index f9bf55c4c..cada52d52 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -6,8 +6,9 @@ [hash (.only Hash)] [\\specification ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" hash]]] + ["$[0]" hash]] + ["[0]" order + ["[1]T" \\test]]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] [math @@ -46,7 +47,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) (_.for [/.order] - ($order.spec /.order ..random)) + (orderT.spec /.order ..random)) (_.for [/.hash] ($hash.spec /.hash ..random)) diff --git a/stdlib/source/test/aedifex/dependency.lux b/stdlib/source/test/aedifex/dependency.lux index fbed2aaaa..3a71c655a 100644 --- a/stdlib/source/test/aedifex/dependency.lux +++ b/stdlib/source/test/aedifex/dependency.lux @@ -5,8 +5,9 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" hash]]] + ["$[0]" hash]] + ["[0]" order + ["[1]T" \\test]]] [math ["[0]" random (.only Random)]] [test @@ -30,7 +31,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) (_.for [/.order] - ($order.spec /.order ..random)) + (orderT.spec /.order ..random)) (_.for [/.hash] ($hash.spec /.hash ..random)) )))) diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux index 36326a58f..55cd89bba 100644 --- a/stdlib/source/test/aedifex/hash.lux +++ b/stdlib/source/test/aedifex/hash.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" codec]]] + ["$[0]" equivalence]] + ["[0]" codec + ["[1]T" \\test]]] [control ["[0]" try] ["[0]" exception]] @@ -70,7 +71,7 @@ )))) (,, (with_template [<codec> <hash>] [(_.for [<codec>] - ($codec.spec /.equivalence <codec> (..random <hash>)))] + (codecT.spec /.equivalence <codec> (..random <hash>)))] [/.sha1_codec /.sha1] [/.md5_codec /.md5] diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 591ad4d5d..387a9c2aa 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -5,8 +5,9 @@ [monad (.only do)] [hash (.only Hash)] [\\specification - ["$[0]" equivalence] - ["$[0]" monoid]]] + ["$[0]" equivalence]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" try]] [data @@ -162,7 +163,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) (_.for [/.monoid] - ($monoid.spec /.equivalence /.monoid ..random)) + (monoidT.spec /.equivalence /.monoid ..random)) (_.coverage [/.default] (text#= "" /.default)) diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index decc5007d..f7040ca66 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" monoid]]] + ["$[0]" equivalence]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" try (.use "[1]#[0]" functor)] ["[0]" exception]] @@ -45,7 +46,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) (_.for [/.monoid] - ($monoid.spec /.equivalence /.monoid ..random)) + (monoidT.spec /.equivalence /.monoid ..random)) (_.coverage [/.file] (|> /.file diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux index acd95096a..6f0278957 100644 --- a/stdlib/source/test/lux/abstract/codec.lux +++ b/stdlib/source/test/lux/abstract/codec.lux @@ -46,3 +46,16 @@ {try.#Failure error} false))))) + +(def .public (spec (open "/#[0]") (open "/#[0]") generator) + (All (_ m a) (-> (Equivalence a) (/.Codec m a) (Random a) Test)) + (do random.monad + [expected generator] + (_.for [/.Codec] + (_.coverage [/.encoded /.decoded] + (when (|> expected /#encoded /#decoded) + {try.#Success actual} + (/#= expected actual) + + {try.#Failure _} + false))))) diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index c14a1cb26..cfdb96682 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -3,9 +3,9 @@ [lux (.except Variant Record) [abstract [monad (.only do)] - [\\specification - [functor - ["$[0]" contravariant]]]] + [functor + ["[0]" contravariant + ["[1]T" \\test]]]] [control ["[0]" maybe]] [data @@ -113,7 +113,7 @@ (<| (_.covering /._) (all _.and (_.for [/.functor] - ($contravariant.spec equivalence n.equivalence /.functor)) + (contravariantT.spec equivalence n.equivalence /.functor)) (_.coverage [/.rec] (let [equivalence (is (Equivalence (List Nat)) (/.rec (function (_ equivalence) diff --git a/stdlib/source/test/lux/abstract/functor/contravariant.lux b/stdlib/source/test/lux/abstract/functor/contravariant.lux index 0bbcfd4aa..7d09e7a44 100644 --- a/stdlib/source/test/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/test/lux/abstract/functor/contravariant.lux @@ -1,6 +1,15 @@ (.require [library [lux (.except) + [abstract + [equivalence (.only Equivalence)] + [monad (.only do)]] + [control + ["[0]" function]] + [math + ["[0]" random] + [number + ["n" nat]]] [test ["_" property (.only Test)]]]] [\\library @@ -10,3 +19,19 @@ Test (<| (_.covering /._) (_.in_parallel (list)))) + +(def .public (spec equivalence value it) + (All (_ ! of) + (-> (Equivalence (! of)) (! of) (/.Functor !) + Test)) + (do random.monad + [sample random.nat] + (<| (_.for [/.Functor]) + (all _.and + (_.coverage [/.each] + (let [law_of_identity! + (of equivalence = + (of it each function.identity value) + value)] + (and law_of_identity!))) + )))) diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux index 9f29b0ec6..fb6bf8925 100644 --- a/stdlib/source/test/lux/abstract/hash.lux +++ b/stdlib/source/test/lux/abstract/hash.lux @@ -3,9 +3,9 @@ [lux (.except) [abstract [monad (.only do)] - [\\specification - [functor - ["$[0]" contravariant]]]] + [functor + ["[0]" contravariant + ["[1]T" \\test]]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math @@ -36,5 +36,5 @@ (<| (_.covering /._) (all _.and (_.for [/.functor] - ($contravariant.spec hash nat.hash /.functor)) + (contravariantT.spec hash nat.hash /.functor)) )))) diff --git a/stdlib/source/test/lux/abstract/monoid.lux b/stdlib/source/test/lux/abstract/monoid.lux index 7708be235..ca63f83c2 100644 --- a/stdlib/source/test/lux/abstract/monoid.lux +++ b/stdlib/source/test/lux/abstract/monoid.lux @@ -32,3 +32,31 @@ (int.= (of int.multiplication composite intL intR) intLR)))) )))) + +(def .public (spec (open "/#[0]") (open "/#[0]") gen_sample) + (All (_ of) + (-> (Equivalence of) (/.Monoid of) (Random of) + Test)) + (do random.monad + [sample gen_sample + left gen_sample + mid gen_sample + right gen_sample] + (<| (_.for [/.Monoid]) + (all _.and + (_.coverage [/.identity] + (let [left_identity! + (/#= sample + (/#composite /#identity sample)) + + right_identity! + (/#= sample + (/#composite sample /#identity))] + (and left_identity! + right_identity!))) + (_.coverage [/.composite] + (let [associativity! + (/#= (/#composite left (/#composite mid right)) + (/#composite (/#composite left mid) right))] + (and associativity!))) + )))) diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index d1ccd5b7d..54e8f3d8d 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -3,9 +3,11 @@ [lux (.except) [abstract [monad (.only do)] - [\\specification - [functor - ["$[0]" contravariant]]]] + [functor + ["[0]" contravariant + ["[1]T" \\test]]] + ["[0]" equivalence + ["[1]T" \\specification]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math @@ -36,7 +38,7 @@ (of rightO < left right))))))]]) (all _.and (_.for [/.functor] - ($contravariant.spec equivalence n.order /.functor)) + (contravariantT.spec equivalence n.order /.functor)) (_.coverage [/.Choice /.min /.max] (n.< (/.max n.order left right) (/.min n.order left right))) @@ -54,3 +56,58 @@ (bit#= (/.> n.order left right) (/.>= n.order left right)))) ))) + +(def .public (spec (open "/#[0]") random) + (All (_ of) + (-> (/.Order of) (Random of) + Test)) + (<| (_.for [/.Order]) + (all _.and + (_.for [/.equivalence] + (equivalenceT.spec /#equivalence random)) + + (do random.monad + [parameter random + subject random + .let [equal_or_ordered! + (let [equal! + (/#= parameter subject) + + ordered! + (or (and (/#< parameter subject) + (not (/#< subject parameter))) + (and (/#< subject parameter) + (not (/#< parameter subject))))] + (bit#= equal! (not ordered!)))] + + subject (random.only (|>> (/#= parameter) not) + random) + extra (random.only (function (_ value) + (not (or (/#= parameter value) + (/#= subject value)))) + random) + .let [transitive_property! + (if (/#< parameter subject) + (let [greater? (and (/#< subject extra) + (/#< parameter extra)) + lesser? (and (/#< extra parameter) + (/#< extra subject)) + in_between? (and (/#< parameter extra) + (/#< extra subject))] + (or greater? + lesser? + in_between?)) + ... (/#< subject parameter) + (let [greater? (and (/#< extra subject) + (/#< extra parameter)) + lesser? (and (/#< parameter extra) + (/#< subject extra)) + in_between? (and (/#< subject extra) + (/#< extra parameter))] + (or greater? + lesser? + in_between?)))]] + (_.coverage [/.<] + (and equal_or_ordered! + transitive_property!))) + ))) diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux index c237e701a..b7794ed63 100644 --- a/stdlib/source/test/lux/control/function.lux +++ b/stdlib/source/test/lux/control/function.lux @@ -4,8 +4,8 @@ [abstract [equivalence (.only Equivalence)] [monad (.only do)] - [\\specification - ["$[0]" monoid]]] + ["[0]" monoid + ["[1]T" \\test]]] [math ["[0]" random (.only Random)] [number @@ -47,7 +47,7 @@ generator (is (Random (-> Nat Nat)) (of ! each n.- random.nat))] (_.for [/.monoid] - ($monoid.spec equivalence /.monoid generator))) + (monoidT.spec equivalence /.monoid generator))) (_.coverage [/.identity] (n.= expected diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 04772297f..92ce0a712 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -4,8 +4,8 @@ [abstract [equivalence (.only Equivalence)] [monad (.only do)] - [\\specification - ["$[0]" monoid]]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" state (.only State)] [function @@ -50,7 +50,7 @@ (_.for [/.Mixin] (all _.and (_.for [/.monoid] - ($monoid.spec equivalence /.monoid generator)) + (monoidT.spec equivalence /.monoid generator)) (_.coverage [/.fixed] (let [factorial (/.fixed diff --git a/stdlib/source/test/lux/control/function/predicate.lux b/stdlib/source/test/lux/control/function/predicate.lux index 74e547932..4abebe702 100644 --- a/stdlib/source/test/lux/control/function/predicate.lux +++ b/stdlib/source/test/lux/control/function/predicate.lux @@ -4,10 +4,11 @@ [abstract [equivalence (.only Equivalence)] [monad (.only do)] - [\\specification - ["$[0]" monoid] - [functor - ["$[0]" contravariant]]]] + ["[0]" monoid + ["[1]T" \\test]] + [functor + ["[0]" contravariant + ["[1]T" \\test]]]] [control ["[0]" function]] [data @@ -43,16 +44,16 @@ (_.for [/.Predicate]) (all _.and (_.for [/.functor] - ($contravariant.spec equivalence (multiple? 2) /.functor)) + (contravariantT.spec equivalence (multiple? 2) /.functor)) (let [generator (is (Random (/.Predicate Nat)) (|> random.nat (random.only (|>> (n.= 0) not)) (of ! each multiple?)))] (all _.and (_.for [/.union] - ($monoid.spec equivalence /.union generator)) + (monoidT.spec equivalence /.union generator)) (_.for [/.intersection] - ($monoid.spec equivalence /.intersection generator)))) + (monoidT.spec equivalence /.intersection generator)))) (_.coverage [/.none] (bit#= false (/.none sample))) diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux index 9e22f6be7..0782a7ad2 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -10,8 +10,9 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" monoid] - ["$[0]" monad]]] + ["$[0]" monad]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" io (.use "[1]#[0]" monad)] ["[0]" pipe]] @@ -41,7 +42,7 @@ (of random.monad each (|>> {.#Some})) ($hash.spec (/.hash n.hash)))) (_.for [/.monoid] - ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat))) + (monoidT.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat))) (_.for [/.functor] (functorT.spec /#in /.equivalence /.functor)) (_.for [/.apply] diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 44af3a44e..95d26678f 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -7,8 +7,9 @@ ["[0]" monad (.only do)] ["[0]" enum] [\\specification - ["$[0]" equivalence] - ["$[0]" monoid]]] + ["$[0]" equivalence]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["<>" parser] ["[0]" pipe] @@ -418,7 +419,7 @@ (_.for [\\format.Mutation \\format.Specification \\format.Format]) (all _.and (_.for [\\format.monoid] - ($monoid.spec ..equivalence \\format.monoid ..random_specification)) + (monoidT.spec ..equivalence \\format.monoid ..random_specification)) ))) (def (succeed result) @@ -554,7 +555,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence (..random size))) (_.for [/.monoid] - ($monoid.spec /.equivalence /.monoid (..random size))) + (monoidT.spec /.equivalence /.monoid (..random size))) (_.coverage [/.mix] (n.= (of list.mix mix n.+ 0 (..as_list sample)) (/.mix n.+ 0 sample))) diff --git a/stdlib/source/test/lux/data/bit.lux b/stdlib/source/test/lux/data/bit.lux index ebdf744af..176b3114a 100644 --- a/stdlib/source/test/lux/data/bit.lux +++ b/stdlib/source/test/lux/data/bit.lux @@ -5,9 +5,11 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" hash]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" function]] [math @@ -28,11 +30,11 @@ (_.for [/.hash] ($hash.spec /.hash random.bit)) (_.for [/.disjunction] - ($monoid.spec /.equivalence /.disjunction random.bit)) + (monoidT.spec /.equivalence /.disjunction random.bit)) (_.for [/.conjunction] - ($monoid.spec /.equivalence /.conjunction random.bit)) + (monoidT.spec /.equivalence /.conjunction random.bit)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec random.bit)) + (codecT.spec /.equivalence /.codec random.bit)) (_.coverage [/.no /.yes] (and (of /.equivalence = false /.no) diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index cec353635..e2e17aa03 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -4,12 +4,12 @@ [abstract [functor (.only)] [monad (.only do)] - ["[0]" monoid - ["$[1]" \\specification]] - ["[0]" mix (.only Mix) - ["$[1]" \\specification]] ["[0]" functor ["[1]T" \\test (.only Injection)]] + ["[0]" mix (.only Mix) + ["$[1]" \\specification]] + ["[0]" monoid + ["[1]T" \\test]] [\\specification ["$[0]" equivalence]]] [control @@ -47,7 +47,7 @@ (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (random.array size random.nat))) (_.for [/.monoid] - ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.array size random.nat))) + (monoidT.spec (/.equivalence n.equivalence) /.monoid (random.array size random.nat))) (_.for [/.functor] (functorT.spec ..injection /.equivalence /.functor)) (_.for [/.mix] @@ -134,7 +134,7 @@ (!.= n.equivalence left right)) (random.array size random.nat))) (_.for [!.composite] - ($monoid.spec (/.equivalence n.equivalence) + (monoidT.spec (/.equivalence n.equivalence) (implementation (def identity (!.empty 0)) (def (composite left right) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 52e2a3183..cbcc11c3d 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -8,10 +8,11 @@ ["[1]T" \\test]] ["[0]" apply ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]] [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" monoid] ["$[0]" mix] ["$[0]" monad]]] [control @@ -58,7 +59,7 @@ (of random.monad each (|>> list)) ($hash.spec (/.hash n.hash)))) (_.for [/.monoid] - ($monoid.spec (/.equivalence n.equivalence) /.monoid ..random)) + (monoidT.spec (/.equivalence n.equivalence) /.monoid ..random)) (_.for [/.mix] ($mix.spec /#in /.equivalence /.mix)) (_.for [/.functor] diff --git a/stdlib/source/test/lux/data/collection/list/property.lux b/stdlib/source/test/lux/data/collection/list/property.lux index 719a17179..06d0141a2 100644 --- a/stdlib/source/test/lux/data/collection/list/property.lux +++ b/stdlib/source/test/lux/data/collection/list/property.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" monoid]]] + ["$[0]" equivalence]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" maybe (.use "[1]#[0]" monad)]] [data @@ -50,7 +51,7 @@ ($equivalence.spec (/.equivalence n.equivalence) (..random size gen_key random.nat))) (_.for [/.monoid] - ($monoid.spec (/.equivalence n.equivalence) + (monoidT.spec (/.equivalence n.equivalence) /.monoid (..random 10 (random.lower_cased 1) random.nat))) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 2d9703523..b2033b46f 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -7,9 +7,10 @@ ["[1]T" \\test (.only Injection)]] ["[0]" apply ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]] [\\specification ["$[0]" equivalence] - ["$[0]" monoid] ["$[0]" mix] ["$[0]" monad]]] [control @@ -38,7 +39,7 @@ (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (random.sequence size random.nat))) (_.for [/.monoid] - ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.sequence size random.nat))) + (monoidT.spec (/.equivalence n.equivalence) /.monoid (random.sequence size random.nat))) (_.for [/.mix] ($mix.spec /#in /.equivalence /.mix)) (_.for [/.functor] diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index d4cff2607..efa67edac 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -6,8 +6,9 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] + ["$[0]" hash]] + ["[0]" monoid + ["[1]T" \\test]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] [collection @@ -40,7 +41,7 @@ (of random.monad each (|>> list (/.of_list n.hash))) ($hash.spec /.hash))) (_.for [/.monoid] - ($monoid.spec /.equivalence (/.monoid n.hash) (random.set n.hash size random.nat))) + (monoidT.spec /.equivalence (/.monoid n.hash) (random.set n.hash size random.nat))) (do ! [sizeL ..gen_nat diff --git a/stdlib/source/test/lux/data/color/rgb.lux b/stdlib/source/test/lux/data/color/rgb.lux index 4325eb72b..2723d5529 100644 --- a/stdlib/source/test/lux/data/color/rgb.lux +++ b/stdlib/source/test/lux/data/color/rgb.lux @@ -5,8 +5,9 @@ [monad (.only do)] [\\specification ["[0]S" equivalence] - ["[0]S" hash] - ["[0]S" monoid]]] + ["[0]S" hash]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" try (.use "[1]#[0]" functor)] ["[0]" exception]] @@ -107,9 +108,9 @@ (_.for [/.hash] (hashS.spec /.hash ..random)) (_.for [/.addition] - (monoidS.spec /.equivalence /.addition ..random)) + (monoidT.spec /.equivalence /.addition ..random)) (_.for [/.subtraction] - (monoidS.spec /.equivalence /.subtraction ..random)) + (monoidT.spec /.equivalence /.subtraction ..random)) (_.coverage [/.rgb] (let [it (/.rgb expected_red expected_green expected_blue)] diff --git a/stdlib/source/test/lux/data/color/scheme.lux b/stdlib/source/test/lux/data/color/scheme.lux index 0a66b7fc8..2d9ccaf3f 100644 --- a/stdlib/source/test/lux/data/color/scheme.lux +++ b/stdlib/source/test/lux/data/color/scheme.lux @@ -5,8 +5,7 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] + ["$[0]" hash]]] [data [collection ["[0]" list]]] diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 60140bae6..0442d17bc 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -7,8 +7,9 @@ ["[0]" equivalence (.only Equivalence) ["[0]/[1]" \\polytypic]] [\\specification - ["$[0]" equivalence] - ["$[0]" codec]]] + ["$[0]" equivalence]] + ["[0]" codec + ["[1]T" \\test]]] [control ["<>" parser] ["[0]" pipe] @@ -263,7 +264,7 @@ (<| (_.covering \\polytypic._) (_.for [\\polytypic.codec] (for @.old (_.test "PLACEHOLDER" true) - ($codec.spec ..equivalence ..codec ..gen_record))))) + (codecT.spec ..equivalence ..codec ..gen_record))))) (def .public random (Random /.JSON) @@ -343,7 +344,7 @@ ($equivalence.spec /.equivalence ..random)) (_.for [/.codec] (all _.and - ($codec.spec /.equivalence /.codec ..random) + (codecT.spec /.equivalence /.codec ..random) (do random.monad [key (random.alphabetic 1) [expected escaped] any_string] diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 644064c47..337ab10b7 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" codec]]] + ["$[0]" equivalence]] + ["[0]" codec + ["[1]T" \\test]]] [control ["<>" parser (.use "[1]#[0]" monad)] ["[0]" maybe] @@ -233,7 +234,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec ..random)) + (codecT.spec /.equivalence /.codec ..random)) (do [! random.monad] [(^.let symbol [namespace name]) ..symbol] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 6dadb8aa6..e7bd6ac8b 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -6,11 +6,14 @@ [equivalence (.only Equivalence)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" order] - ["$[0]" monoid] - [functor - ["$[0]" contravariant]]]] + ["$[0]" hash]] + [functor + ["[0]" contravariant + ["[1]T" \\test]]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["<>" parser] ["[0]" pipe] @@ -157,7 +160,7 @@ (do random.monad [[format random] ..random_contravariant example random] - ($contravariant.spec (..equivalence example) + (contravariantT.spec (..equivalence example) format \\format.functor))) @@ -864,9 +867,9 @@ (_.for [/.hash] ($hash.spec /.hash (random.ascii 1))) (_.for [/.order] - ($order.spec /.order (random.ascii 2))) + (orderT.spec /.order (random.ascii 2))) (_.for [/.monoid] - ($monoid.spec /.equivalence /.monoid (random.ascii 2))) + (monoidT.spec /.equivalence /.monoid (random.ascii 2))) ..size ..affix diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index e573de1d3..d6c30f981 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -2,9 +2,7 @@ [library [lux (.except) [abstract - [monad (.only do)] - [\\specification - ["$[0]" codec]]] + [monad (.only do)]] [control ["[0]" maybe] ["[0]" try]] diff --git a/stdlib/source/test/lux/data/text/encoding/utf8.lux b/stdlib/source/test/lux/data/text/encoding/utf8.lux index 38e57a1b0..9b187eca6 100644 --- a/stdlib/source/test/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/test/lux/data/text/encoding/utf8.lux @@ -2,8 +2,8 @@ [library [lux (.except) [abstract - [\\specification - ["$[0]" codec]]] + ["[0]" codec + ["[1]T" \\test]]] [data ["[0]" text]] [math @@ -17,4 +17,4 @@ Test (<| (_.covering /._) (_.for [/.codec] - ($codec.spec text.equivalence /.codec (random.unicode 5))))) + (codecT.spec text.equivalence /.codec (random.unicode 5))))) diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 6ea3e3493..370740c9a 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -5,8 +5,9 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] + ["$[0]" hash]] + ["[0]" monoid + ["[1]T" \\test]]] [data ["[0]" text] [collection @@ -190,7 +191,7 @@ (_.for [/.hash] ($hash.spec /.hash ..random)) (_.for [/.monoid] - ($monoid.spec /.equivalence /.monoid ..random)) + (monoidT.spec /.equivalence /.monoid ..random)) (_.for [/.block] (all _.and diff --git a/stdlib/source/test/lux/math/arithmetic/fixed_point.lux b/stdlib/source/test/lux/math/arithmetic/fixed_point.lux index bff8264f2..f02901c87 100644 --- a/stdlib/source/test/lux/math/arithmetic/fixed_point.lux +++ b/stdlib/source/test/lux/math/arithmetic/fixed_point.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["[0]S" equivalence] - ["[0]S" order]]] + ["[0]S" equivalence]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" try (.use "[1]#[0]" functor)] ["[0]" exception]] @@ -65,7 +66,7 @@ (_.for [/.equivalence /.=] (equivalenceS.spec (/.equivalence @) (..random @))) (_.for [/.order /.<] - (orderS.spec (/.order @) (..random @))) + (orderT.spec (/.order @) (..random @))) (_.for [/.arithmetic] (arithmeticS.spec (/.equivalence @) (/.arithmetic @) (..random @))) diff --git a/stdlib/source/test/lux/math/arithmetic/modular.lux b/stdlib/source/test/lux/math/arithmetic/modular.lux index 4d05bacbe..0d0a85f46 100644 --- a/stdlib/source/test/lux/math/arithmetic/modular.lux +++ b/stdlib/source/test/lux/math/arithmetic/modular.lux @@ -4,10 +4,13 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" equivalence]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" try] ["[0]" exception] @@ -56,16 +59,16 @@ (_.for [/.equivalence /.=] ($equivalence.spec /.equivalence (..random subject::%))) (_.for [/.order /.<] - ($order.spec /.order (..random subject::%))) + (orderT.spec /.order (..random subject::%))) (,, (with_template [<composite> <monoid>] [(_.for [<monoid> <composite>] - ($monoid.spec /.equivalence (<monoid> subject::%) (..random subject::%)))] + (monoidT.spec /.equivalence (<monoid> subject::%) (..random subject::%)))] [/.+ /.addition] [/.* /.multiplication] )) (_.for [/.codec] - ($codec.spec /.equivalence (/.codec subject::%) (..random subject::%))) + (codecT.spec /.equivalence (/.codec subject::%) (..random subject::%))) (_.coverage [/.incorrect_modulus] (when (|> param diff --git a/stdlib/source/test/lux/math/arithmetic/saturation.lux b/stdlib/source/test/lux/math/arithmetic/saturation.lux index 3ef3adb94..6b1e52a9b 100644 --- a/stdlib/source/test/lux/math/arithmetic/saturation.lux +++ b/stdlib/source/test/lux/math/arithmetic/saturation.lux @@ -36,16 +36,14 @@ (and (within_boundaries? [min max] (/#+ parameter subject)) (within_boundaries? [min max] (/#- parameter subject)) (within_boundaries? [min max] (/#* parameter subject)) - (within_boundaries? [min max] (/#/ parameter subject)) - (within_boundaries? [min max] (/#% parameter subject)))) + (within_boundaries? [min max] (/#/ parameter subject)))) the_order_of_the_boundaries_does_not_matter! (let [(open "/#[0]") (/.arithmetic n.order [max min] n.arithmetic)] (and (within_boundaries? [min max] (/#+ parameter subject)) (within_boundaries? [min max] (/#- parameter subject)) (within_boundaries? [min max] (/#* parameter subject)) - (within_boundaries? [min max] (/#/ parameter subject)) - (within_boundaries? [min max] (/#% parameter subject))))] + (within_boundaries? [min max] (/#/ parameter subject))))] (and boundaries_are_respected! the_order_of_the_boundaries_does_not_matter!))) ))) diff --git a/stdlib/source/test/lux/math/logic/continuous.lux b/stdlib/source/test/lux/math/logic/continuous.lux index 184b5163d..83d816452 100644 --- a/stdlib/source/test/lux/math/logic/continuous.lux +++ b/stdlib/source/test/lux/math/logic/continuous.lux @@ -3,8 +3,8 @@ [lux (.except) [abstract [monad (.only do)] - [\\specification - ["$[0]" monoid]]] + ["[0]" monoid + ["[1]T" \\test]]] [math ["[0]" random] [number @@ -24,7 +24,7 @@ (`` (all _.and (,, (with_template [<monoid>] [(_.for [<monoid>] - ($monoid.spec r.= <monoid> random.rev))] + (monoidT.spec r.= <monoid> random.rev))] [/.disjunction] [/.conjunction] diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 39d67239b..f132cc68e 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -4,9 +4,9 @@ [abstract [equivalence (.only Equivalence)] [monad (.only do)] - [\\specification - [functor - ["$[0]" contravariant]]]] + [functor + ["[0]" contravariant + ["[1]T" \\test]]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] [collection @@ -347,7 +347,7 @@ (right sample)))))]] (all _.and (_.for [/.functor] - ($contravariant.spec equivalence fuzzy /.functor)) + (contravariantT.spec equivalence fuzzy /.functor)) ..trivial ..simple diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 0e4f99ed6..fbfeb7021 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -6,10 +6,13 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" order] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" hash]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math @@ -105,10 +108,10 @@ (_.for [/.hash] ($hash.spec /.hash random.frac)) (_.for [/.order /.<] - ($order.spec /.order random.safe_frac)) + (orderT.spec /.order random.safe_frac)) (,, (with_template [<composite> <monoid>] [(_.for [<monoid> <composite>] - ($monoid.spec /.equivalence <monoid> ..random))] + (monoidT.spec /.equivalence <monoid> ..random))] [/.+ /.addition] [/.* /.multiplication] @@ -118,7 +121,7 @@ )) (,, (with_template [<codec>] [(_.for [<codec>] - ($codec.spec /.equivalence <codec> random.safe_frac))] + (codecT.spec /.equivalence <codec> random.safe_frac))] [/.binary] [/.octal] [/.decimal] [/.hex] )) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 95a19b447..8a5028a6f 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -7,8 +7,9 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] + ["$[0]" hash]] + ["[0]" monoid + ["[1]T" \\test]]] [math ["[0]" random (.only Random)]] [test @@ -155,9 +156,9 @@ (_.for [/.hash] ($hash.spec /.hash random.i64)) (_.for [/.disjunction] - ($monoid.spec n.equivalence /.disjunction random.nat)) + (monoidT.spec n.equivalence /.disjunction random.nat)) (_.for [/.conjunction] - ($monoid.spec n.equivalence /.conjunction random.nat)) + (monoidT.spec n.equivalence /.conjunction random.nat)) )) (def .public test diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux index 6223d9316..cd444a6e7 100644 --- a/stdlib/source/test/lux/math/number/int.lux +++ b/stdlib/source/test/lux/math/number/int.lux @@ -6,11 +6,14 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" order] ["$[0]" enum] - ["$[0]" interval] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" interval]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math @@ -34,14 +37,14 @@ (_.for [/.hash] ($hash.spec /.hash random.int)) (_.for [/.order /.<] - ($order.spec /.order random.int)) + (orderT.spec /.order random.int)) (_.for [/.enum] ($enum.spec /.enum random.int)) (_.for [/.interval] ($interval.spec /.interval random.int)) (,, (with_template [<monoid>] [(_.for [<monoid>] - ($monoid.spec /.equivalence <monoid> random.int))] + (monoidT.spec /.equivalence <monoid> random.int))] [/.addition] [/.multiplication] @@ -51,7 +54,7 @@ )) (,, (with_template [<codec>] [(_.for [<codec>] - ($codec.spec /.equivalence <codec> random.int))] + (codecT.spec /.equivalence <codec> random.int))] [/.binary] [/.octal] [/.decimal] [/.hex] )) diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux index 6cd7bafd5..c56fb392b 100644 --- a/stdlib/source/test/lux/math/number/nat.lux +++ b/stdlib/source/test/lux/math/number/nat.lux @@ -6,11 +6,14 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" order] ["$[0]" enum] - ["$[0]" interval] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" interval]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math @@ -32,14 +35,14 @@ (_.for [/.hash] ($hash.spec /.hash random.nat)) (_.for [/.order /.<] - ($order.spec /.order random.nat)) + (orderT.spec /.order random.nat)) (_.for [/.enum] ($enum.spec /.enum random.nat)) (_.for [/.interval] ($interval.spec /.interval random.nat)) (,, (with_template [<composite> <monoid>] [(_.for [<monoid> <composite>] - ($monoid.spec /.equivalence <monoid> random.nat))] + (monoidT.spec /.equivalence <monoid> random.nat))] [/.+ /.addition] [/.* /.multiplication] @@ -49,7 +52,7 @@ )) (,, (with_template [<codec>] [(_.for [<codec>] - ($codec.spec /.equivalence <codec> random.nat))] + (codecT.spec /.equivalence <codec> random.nat))] [/.binary] [/.octal] [/.decimal] [/.hex] )) diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 1392162c3..c4bfcac60 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -4,10 +4,13 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" equivalence]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["[0]" maybe (.use "[1]#[0]" functor)]] [data @@ -45,16 +48,16 @@ (_.for [/.equivalence /.=] ($equivalence.spec /.equivalence ..random)) (_.for [/.order /.<] - ($order.spec /.order ..random)) + (orderT.spec /.order ..random)) (,, (with_template [<composite> <monoid>] [(_.for [<monoid> <composite>] - ($monoid.spec /.equivalence <monoid> ..random))] + (monoidT.spec /.equivalence <monoid> ..random))] [/.+ /.addition] [/.* /.multiplication] )) (_.for [/.codec] - ($codec.spec /.equivalence /.codec ..random)) + (codecT.spec /.equivalence /.codec ..random)) (_.for [/.arithmetic] (arithmeticS.spec /.equivalence /.arithmetic ..random)) diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux index 80b5b4a5a..c570191c2 100644 --- a/stdlib/source/test/lux/math/number/rev.lux +++ b/stdlib/source/test/lux/math/number/rev.lux @@ -6,11 +6,14 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" order] ["$[0]" enum] - ["$[0]" interval] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" interval]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math @@ -34,14 +37,14 @@ (_.for [/.hash] ($hash.spec /.hash random.rev)) (_.for [/.order /.<] - ($order.spec /.order random.rev)) + (orderT.spec /.order random.rev)) (_.for [/.enum] ($enum.spec /.enum random.rev)) (_.for [/.interval] ($interval.spec /.interval random.rev)) (,, (with_template [<composite> <monoid>] [(_.for [<monoid> <composite>] - ($monoid.spec /.equivalence <monoid> random.rev))] + (monoidT.spec /.equivalence <monoid> random.rev))] [/.+ /.addition] @@ -50,7 +53,7 @@ )) (,, (with_template [<codec>] [(_.for [<codec>] - ($codec.spec /.equivalence <codec> random.rev))] + (codecT.spec /.equivalence <codec> random.rev))] [/.binary] [/.octal] [/.decimal] [/.hex] )) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 75cb0d09b..80f9231cf 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -42,7 +42,7 @@ ... ["[1][0]" symbol] ... ["[1][0]" configuration] ... ["[1][0]" version] - ... ["[1][0]" type] + ["[1][0]" type] ... ["[1][0]" macro] ... ["[1][0]" static] ["[1][0]" extension] @@ -56,7 +56,6 @@ ... "Ruby" (.,, (.these ["[1]/[0]" ruby])) ... (.,, (.these))))] ["[1][0]" compiler - ... ["[1]/[0]" arity] ... ["[1]/[0]" version] ... ["[1]/[0]" reference] ... ["[1]/[0]" phase] @@ -530,179 +529,179 @@ )))) ))) -... (def search_related -... Test -... (do [! random.monad] -... [expected_exported? random.bit -... expected_current_module (random.upper_cased 1) -... expected_macro_module (random.only (|>> (text#= expected_current_module) not) -... (random.upper_cased 1)) -... expected_short (random.upper_cased 1) -... expected_type (of ! each (function (_ name) -... {.#Nominal name (list)}) -... (random.upper_cased 1)) -... expected_value (random.either (in .def) -... (in .macro)) -... .let [expected_lux -... (is (-> Bit (Maybe Type) -... [(List [Text .Global]) -... (List [Text .Global]) -... Lux]) -... (function (_ exported? def_type) -... (let [current_globals (is (List [Text .Global]) -... (list [expected_short -... {.#Alias [expected_macro_module expected_short]}])) -... macro_globals (is (List [Text .Global]) -... (when def_type -... {.#Some def_type} -... (list [expected_short -... {.#Definition [exported? def_type expected_value]}]) +(def search_related + Test + (do [! random.monad] + [expected_exported? random.bit + expected_current_module (random.upper_cased 1) + expected_macro_module (random.only (|>> (text#= expected_current_module) not) + (random.upper_cased 1)) + expected_short (random.upper_cased 1) + expected_type (of ! each (function (_ name) + {.#Nominal name (list)}) + (random.upper_cased 1)) + expected_value (random.either (in .def) + (in .macro)) + .let [expected_lux + (is (-> Bit (Maybe Type) + [(List [Text [Bit .Global]]) + (List [Text [Bit .Global]]) + Lux]) + (function (_ exported? def_type) + (let [current_globals (is (List [Text [Bit .Global]]) + (list [expected_short + [false {.#Alias [expected_macro_module expected_short]}]])) + macro_globals (is (List [Text [Bit .Global]]) + (when def_type + {.#Some def_type} + (list [expected_short + [exported? {.#Definition [def_type expected_value]}]]) -... {.#None} -... (list)))] -... [current_globals -... macro_globals -... [.#info [.#target "" -... .#version "" -... .#mode {.#Build} -... .#configuration (list)] -... .#source [location.dummy 0 ""] -... .#location location.dummy -... .#current_module {.#Some expected_current_module} -... .#modules (list [expected_current_module -... [.#module_hash 0 -... .#module_aliases (list) -... .#definitions current_globals -... .#imports (list) -... .#module_state {.#Active}]] -... [expected_macro_module -... [.#module_hash 0 -... .#module_aliases (list) -... .#definitions macro_globals -... .#imports (list) -... .#module_state {.#Active}]]) -... .#scopes (list) -... .#type_context [.#ex_counter 0 -... .#var_counter 0 -... .#var_bindings (list)] -... .#expected {.#None} -... .#seed 0 -... .#scope_type_vars (list) -... .#extensions [] -... .#eval (as (-> Type Code (Meta Any)) []) -... .#host []]])))]] -... (all _.and -... (_.coverage [/.export] -... (and (let [[current_globals macro_globals expected_lux] -... (expected_lux true {.#Some expected_type})] -... (|> (/.export [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect {try.#Success _}))) -... (let [[current_globals macro_globals expected_lux] -... (expected_lux false {.#Some expected_type})] -... (|> (/.export [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect {try.#Failure _}))))) -... (_.coverage [/.macro] -... (let [same_module! -... (let [[current_globals macro_globals expected_lux] -... (expected_lux true {.#Some .Macro})] -... (|> (/.macro [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success {.#Some actual_value}} -... (same? expected_value actual_value))))) + {.#None} + (list)))] + [current_globals + macro_globals + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some expected_current_module} + .#modules (list [expected_current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions current_globals + .#imports (list) + .#module_state {.#Active}]] + [expected_macro_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions macro_globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []]])))]] + (all _.and + (_.coverage [/.export] + (and (let [[current_globals macro_globals expected_lux] + (expected_lux true {.#Some expected_type})] + (|> (/.export [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect {try.#Success _}))) + (let [[current_globals macro_globals expected_lux] + (expected_lux false {.#Some expected_type})] + (|> (/.export [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect {try.#Failure _}))))) + (_.coverage [/.macro] + (let [same_module! + (let [[current_globals macro_globals expected_lux] + (expected_lux true {.#Some .Macro})] + (|> (/.macro [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success {.#Some actual_value}} + (same? expected_value actual_value))))) -... not_macro! -... (let [[current_globals macro_globals expected_lux] -... (expected_lux true {.#Some expected_type})] -... (|> (/.macro [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect {try.#Success {.#None}}))) + not_macro! + (let [[current_globals macro_globals expected_lux] + (expected_lux true {.#Some expected_type})] + (|> (/.macro [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect {try.#Success {.#None}}))) -... not_found! -... (let [[current_globals macro_globals expected_lux] -... (expected_lux true {.#None})] -... (|> (/.macro [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect {try.#Success {.#None}}))) + not_found! + (let [[current_globals macro_globals expected_lux] + (expected_lux true {.#None})] + (|> (/.macro [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect {try.#Success {.#None}}))) -... aliasing! -... (let [[current_globals macro_globals expected_lux] -... (expected_lux true {.#Some .Macro})] -... (|> (/.macro [expected_current_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success {.#Some actual_value}} -... (same? expected_value actual_value)))))] -... (and same_module! -... not_macro! -... not_found! -... aliasing!))) -... (_.coverage [/.de_aliased] -... (let [[current_globals macro_globals expected_lux] -... (expected_lux true {.#Some .Macro})] -... (and (|> (/.de_aliased [expected_macro_module expected_short]) -... (/.result expected_lux) -... (try#each (symbol#= [expected_macro_module expected_short])) -... (try.else false)) -... (|> (/.de_aliased [expected_current_module expected_short]) -... (/.result expected_lux) -... (try#each (symbol#= [expected_macro_module expected_short])) -... (try.else false))))) -... (_.coverage [/.definition] -... (let [[current_globals macro_globals expected_lux] -... (expected_lux expected_exported? {.#Some expected_type}) + aliasing! + (let [[current_globals macro_globals expected_lux] + (expected_lux true {.#Some .Macro})] + (|> (/.macro [expected_current_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success {.#Some actual_value}} + (same? expected_value actual_value)))))] + (and same_module! + not_macro! + not_found! + aliasing!))) + (_.coverage [/.de_aliased] + (let [[current_globals macro_globals expected_lux] + (expected_lux true {.#Some .Macro})] + (and (|> (/.de_aliased [expected_macro_module expected_short]) + (/.result expected_lux) + (try#each (symbol#= [expected_macro_module expected_short])) + (try.else false)) + (|> (/.de_aliased [expected_current_module expected_short]) + (/.result expected_lux) + (try#each (symbol#= [expected_macro_module expected_short])) + (try.else false))))) + (_.coverage [/.definition] + (let [[current_globals macro_globals expected_lux] + (expected_lux expected_exported? {.#Some expected_type}) -... definition! -... (|> (/.definition [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success {.#Definition [actual_exported? actual_type actual_value]}} -... (and (bit#= expected_exported? actual_exported?) -... (same? expected_type actual_type) -... (same? (as Any expected_value) actual_value))))) + definition! + (|> (/.definition [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success [actual_exported? {.#Definition [actual_type actual_value]}]} + (and (bit#= expected_exported? actual_exported?) + (same? expected_type actual_type) + (same? (as Any expected_value) actual_value))))) -... alias! -... (|> (/.definition [expected_current_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success {.#Alias [actual_module actual_short]}} -... (and (same? expected_macro_module actual_module) -... (same? expected_short actual_short)))))] -... (and definition! -... alias!))) -... (_.coverage [/.definition_type] -... (let [[current_globals macro_globals expected_lux] -... (expected_lux expected_exported? {.#Some expected_type}) + alias! + (|> (/.definition [expected_current_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success [.false {.#Alias [actual_module actual_short]}]} + (and (same? expected_macro_module actual_module) + (same? expected_short actual_short)))))] + (and definition! + alias!))) + (_.coverage [/.definition_type] + (let [[current_globals macro_globals expected_lux] + (expected_lux expected_exported? {.#Some expected_type}) -... definition! -... (|> (/.definition_type [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success actual_type} -... (same? expected_type actual_type)))) + definition! + (|> (/.definition_type [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success actual_type} + (same? expected_type actual_type)))) -... alias! -... (|> (/.definition_type [expected_current_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success actual_type} -... (same? expected_type actual_type))))] -... (and definition! -... alias!))) -... (_.coverage [/.type_definition] -... (let [[current_globals macro_globals expected_lux] -... (expected_lux expected_exported? {.#Some .Type}) + alias! + (|> (/.definition_type [expected_current_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success actual_type} + (same? expected_type actual_type))))] + (and definition! + alias!))) + (_.coverage [/.type_definition] + (let [[current_globals macro_globals expected_lux] + (expected_lux expected_exported? {.#Some .Type}) -... definition! -... (|> (/.type_definition [expected_macro_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success actual_value} -... (same? (as .Type expected_value) actual_value)))) + definition! + (|> (/.type_definition [expected_macro_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success actual_value} + (same? (as .Type expected_value) actual_value)))) -... alias! -... (|> (/.type_definition [expected_current_module expected_short]) -... (/.result expected_lux) -... (!expect (^.multi {try.#Success actual_value} -... (same? (as .Type expected_value) actual_value))))] -... (and definition! -... alias!))) -... ))) + alias! + (|> (/.type_definition [expected_current_module expected_short]) + (/.result expected_lux) + (!expect (^.multi {try.#Success actual_value} + (same? (as .Type expected_value) actual_value))))] + (and definition! + alias!))) + ))) ... (def label_related ... Test @@ -1056,7 +1055,7 @@ ..module_related ..context_related ..definition_related - ... ..search_related + ..search_related ... ..locals_related ... (_.for [.Label] ... ..label_related) @@ -1067,7 +1066,7 @@ ... /symbol.test ... /configuration.test ... /version.test - ... /type.test + /type.test ... /macro.test ... /static.test ... /target.test @@ -1082,7 +1081,6 @@ /global.test /compiler.test - ... /compiler/arity.test ... /compiler/version.test ... /compiler/reference.test ... /compiler/phase.test diff --git a/stdlib/source/test/lux/meta/compiler.lux b/stdlib/source/test/lux/meta/compiler.lux index 6e56ccfac..a6589b9d5 100644 --- a/stdlib/source/test/lux/meta/compiler.lux +++ b/stdlib/source/test/lux/meta/compiler.lux @@ -8,7 +8,11 @@ [test ["_" property (.only Test)]]]] [\\library - ["[0]" /]]) + ["[0]" /]] + ["[0]" / + ["[1][0]" arity] + ["[1][0]" language + ["[1]/[0]" lux]]]) (def .public test Test @@ -18,4 +22,7 @@ (all _.and (_.coverage [/.Code /.Parameter /.Input] true) + + /arity.test + /language/lux.test ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux.lux new file mode 100644 index 000000000..ed26027df --- /dev/null +++ b/stdlib/source/test/lux/meta/compiler/language/lux.lux @@ -0,0 +1,128 @@ +(.require + [library + [lux (.except global) + [abstract + [equivalence (.only Equivalence)] + [monad (.only do)]] + [control + ["[0]" try (.use "[1]#[0]" functor)]] + [data + ["[0]" sum] + ["[0]" product] + ["[0]" bit] + ["[0]" text (.use "[1]#[0]" equivalence)] + ["[0]" binary + ["![1]" \\format] + ["?[1]" \\parser]] + [collection + ["[0]" list]]] + [math + ["[0]" random (.only Random) (.use "[1]#[0]" monad)] + [number + ["[0]" nat]]] + [meta + ["[0]" version] + ["[0]" type (.only) + ["[1]T" \\test]] + ["[0]" symbol (.only) + ["[1]T" \\test]] + [compiler + [meta + [archive + ["[0]" key] + ["[0]" signature]]]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" /]]) + +(def any_equivalence + (Equivalence Any) + (implementation + (def (= _ _) + true))) + +(def definition_equivalence + (Equivalence Definition) + (all product.equivalence + type.equivalence + ..any_equivalence + )) + +(def definition + (Random Definition) + (do random.monad + [type (typeT.random 1)] + (in [type []]))) + +(def global_equivalence + (Equivalence Global) + (all sum.equivalence + ..definition_equivalence + symbol.equivalence + ..definition_equivalence + )) + +(def global + (Random Global) + (all random.or + ..definition + (symbolT.random 1 1) + ..definition + )) + +(def module_state_equivalence + (Equivalence Module_State) + (all sum.equivalence + ..any_equivalence + ..any_equivalence + ..any_equivalence + )) + +(def module_state + (Random Module_State) + (all random.or + (random#in []) + (random#in []) + (random#in []) + )) + +(def module_equivalence + (Equivalence Module) + (all product.equivalence + nat.equivalence + (list.equivalence (product.equivalence text.equivalence text.equivalence)) + (list.equivalence (all product.equivalence text.equivalence bit.equivalence global_equivalence)) + (list.equivalence text.equivalence) + ..module_state_equivalence + )) + +(def module + (Random Module) + (all random.and + random.nat + (random.list 1 (random.and (random.upper_cased 2) (random.upper_cased 3))) + (random.list 4 (all random.and (random.upper_cased 5) random.bit ..global)) + (random.list 6 (random.upper_cased 7)) + ..module_state + )) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected ..module]) + (all _.and + (_.coverage [/.format /.parser] + (|> expected + (!binary.result /.format) + (?binary.result /.parser) + (try#each (of module_equivalence = (has .#module_state {.#Cached} expected))) + (try.else false))) + (_.coverage [/.key] + (let [it (key.signature /.key)] + (and (let [[expected_module _] (symbol /._) + [actual_module actual_short] (the signature.#name it)] + (and (text#= expected_module actual_module))) + (same? version.latest (the signature.#version it))))) + ))) diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux index 24a6ecf76..b505f54d4 100644 --- a/stdlib/source/test/lux/meta/configuration.lux +++ b/stdlib/source/test/lux/meta/configuration.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" monoid]]] + ["$[0]" equivalence]] + ["[0]" monoid + ["[1]T" \\test]]] [control ["<>" parser] ["[0]" try (.use "[1]#[0]" functor)] @@ -58,7 +59,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence (..random 5))) (_.for [/.monoid] - ($monoid.spec /.equivalence /.monoid (..random 5))) + (monoidT.spec /.equivalence /.monoid (..random 5))) (_.coverage [/.empty] (list.empty? /.empty)) diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index d16275357..9751bc770 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -5,9 +5,11 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" order] - ["$[0]" codec]]] + ["$[0]" hash]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]]] [data ["[0]" text]] [math @@ -48,9 +50,9 @@ (of ! each (|>> [""])) ($hash.spec /.hash))) (_.for [/.order] - ($order.spec /.order (..random sizeM1 sizeS1))) + (orderT.spec /.order (..random sizeM1 sizeS1))) (_.for [/.codec] - (_.and ($codec.spec /.equivalence /.codec (..random sizeM1 sizeS1)) + (_.and (codecT.spec /.equivalence /.codec (..random sizeM1 sizeS1)) (_.test "Encoding a symbol without a module component results in text equal to the short of the symbol." (if (text.empty? module1) (same? short1 (of /.codec encoded symbol1)) diff --git a/stdlib/source/test/lux/meta/type/unit.lux b/stdlib/source/test/lux/meta/type/unit.lux index 6c27c1900..d13ba3680 100644 --- a/stdlib/source/test/lux/meta/type/unit.lux +++ b/stdlib/source/test/lux/meta/type/unit.lux @@ -6,8 +6,9 @@ [equivalence (.only Equivalence)] [\\specification ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum]]] + ["$[0]" enum]] + ["[0]" order + ["[1]T" \\test]]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format]]] @@ -43,7 +44,7 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence (..meter 1,000))) (_.for [/.order] - ($order.spec /.order (..meter 1,000))) + (orderT.spec /.order (..meter 1,000))) (_.for [/.enum] ($enum.spec /.enum (..meter 1,000))) )) diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux index 3793d49ee..e4f9f5cec 100644 --- a/stdlib/source/test/lux/world.lux +++ b/stdlib/source/test/lux/world.lux @@ -18,6 +18,7 @@ ["[1]/[0]" trade ["[1]/[0]" session]] ["[1]/[0]" market + ["[1]/[0]" price] ["[1]/[0]" analysis ["[1]/[0]" accumulation_distribution]]]] ["[1][0]" net] @@ -38,6 +39,7 @@ /finance/money.test /finance/trade/session.test + /finance/market/price.test /finance/market/analysis/accumulation_distribution.test /net.test diff --git a/stdlib/source/test/lux/world/finance/market/price.lux b/stdlib/source/test/lux/world/finance/market/price.lux new file mode 100644 index 000000000..d5b8232b5 --- /dev/null +++ b/stdlib/source/test/lux/world/finance/market/price.lux @@ -0,0 +1,106 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)] + [\\specification + ["[0]S" equivalence]] + ["[0]" order + ["[1]T" \\test]]] + [control + ["[0]" maybe (.use "[1]#[0]" functor)]] + [data + ["[0]" bit (.use "[1]#[0]" equivalence)] + ["[0]" text (.only) + ["%" \\format]]] + [math + ["[0]" random (.only Random) (.use "[1]#[0]" functor)] + [number + ["i" int]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [/// + [money + ["[0]" currency (.only Currency)]]]]]) + +(def .public (random $) + (All (_ $) + (-> (Currency $) + (Random (/.Action $)))) + (random#each (/.action $) + random.int)) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_movement random.int + + expected_parameter random.int + expected_subject random.int]) + (_.for [/.Price /.Action]) + (all _.and + (_.for [/.equivalence /.=] + (equivalenceS.spec /.equivalence (..random currency.usd))) + (_.for [/.order /.<] + (orderT.spec /.order (..random currency.usd))) + + (_.coverage [/.action /.currency /.movement] + (let [it (/.action currency.usd expected_movement)] + (and (same? currency.usd (/.currency it)) + (same? expected_movement (/.movement it))))) + (_.coverage [/.+ /.-] + (let [parameter (/.action currency.usd expected_parameter) + subject (/.action currency.usd expected_subject)] + (and (|> subject + (/.+ parameter) + (of /.equivalence = subject) + not) + (|> subject + (/.+ parameter) + (/.- parameter) + (of /.equivalence = subject))))) + (_.coverage [/.min] + (let [expected_parameter (/.action currency.usd expected_parameter) + expected_subject (/.action currency.usd expected_subject)] + (and (/.<= expected_parameter + (/.min expected_parameter expected_subject)) + (/.<= expected_subject + (/.min expected_parameter expected_subject))))) + (_.coverage [/.max] + (let [expected_parameter (/.action currency.usd expected_parameter) + expected_subject (/.action currency.usd expected_subject)] + (and (/.>= expected_parameter + (/.max expected_parameter expected_subject)) + (/.>= expected_subject + (/.max expected_parameter expected_subject))))) + (let [expected_parameter (/.action currency.usd expected_parameter) + expected_subject (/.action currency.usd expected_subject)] + (all _.and + (_.coverage [/.>] + (bit#= (/.> expected_parameter expected_subject) + (/.< expected_subject expected_parameter))) + (_.coverage [/.<= /.>=] + (bit#= (/.<= expected_parameter expected_subject) + (/.>= expected_subject expected_parameter))) + )) + (_.coverage [/.units /.sub_units] + (let [expected (/.action currency.usd expected_movement) + actual (/.action currency.usd (i.+ (/.units expected) + (/.sub_units expected)))] + (/.= expected actual))) + (_.coverage [/.of_units /.of_sub_units] + (let [expected (/.action currency.usd expected_movement) + actual (/.+ (/.of_units currency.usd (/.units expected)) + (/.of_sub_units currency.usd (/.sub_units expected)))] + (/.= expected actual))) + (do ! + [it (..random currency.usd)] + (_.coverage [/.format] + (and (text.starts_with? (%.int (/.movement it)) + (text.replaced_once "." "" (/.format it))) + (text.ends_with? (currency.alphabetic_code (/.currency it)) + (/.format it))))) + ))) diff --git a/stdlib/source/test/lux/world/finance/money.lux b/stdlib/source/test/lux/world/finance/money.lux index 773589a15..073f19f34 100644 --- a/stdlib/source/test/lux/world/finance/money.lux +++ b/stdlib/source/test/lux/world/finance/money.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["[0]S" equivalence] - ["[0]S" order]]] + ["[0]S" equivalence]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" maybe (.use "[1]#[0]" functor)]] [data @@ -44,7 +45,7 @@ (_.for [/.equivalence /.=] (equivalenceS.spec /.equivalence (..random currency.usd))) (_.for [/.order /.<] - (orderS.spec /.order (..random currency.usd))) + (orderT.spec /.order (..random currency.usd))) (_.coverage [/.money /.currency /.amount] (let [it (/.money currency.usd expected_amount)] diff --git a/stdlib/source/test/lux/world/finance/trade/session.lux b/stdlib/source/test/lux/world/finance/trade/session.lux index 6ce1979d2..7519d63e3 100644 --- a/stdlib/source/test/lux/world/finance/trade/session.lux +++ b/stdlib/source/test/lux/world/finance/trade/session.lux @@ -56,7 +56,7 @@ (do [! random.monad] [before (..random currency.usd) after (..random currency.usd)]) - (_.for [/.Session /.Price /.Volume + (_.for [/.Session /.Volume /.#open /.#high /.#low /.#close /.#volume]) (all _.and (_.for [/.equivalence] diff --git a/stdlib/source/test/lux/world/net/uri/query.lux b/stdlib/source/test/lux/world/net/uri/query.lux index ecdd3c2c4..4ac981426 100644 --- a/stdlib/source/test/lux/world/net/uri/query.lux +++ b/stdlib/source/test/lux/world/net/uri/query.lux @@ -4,8 +4,9 @@ [abstract [monad (.only do)] [\\specification - ["[0]S" equivalence] - ["[0]S" codec]]] + ["[0]S" equivalence]] + ["[0]" codec + ["[1]T" \\test]]] [data [collection ["[0]" dictionary]]] @@ -36,7 +37,7 @@ (_.for [/.equivalence] (equivalenceS.spec /.equivalence (..random 2))) (_.for [/.codec] - (codecS.spec /.equivalence /.codec (..random 3))) + (codecT.spec /.equivalence /.codec (..random 3))) (_.coverage [/.empty] (dictionary.empty? /.empty)) diff --git a/stdlib/source/test/lux/world/time.lux b/stdlib/source/test/lux/world/time.lux index 95ddb6370..4997cb844 100644 --- a/stdlib/source/test/lux/world/time.lux +++ b/stdlib/source/test/lux/world/time.lux @@ -5,9 +5,11 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] + ["$[0]" enum]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" pipe] ["[0]" try (.use "[1]#[0]" functor)] @@ -41,11 +43,11 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence random.time)) (_.for [/.order] - ($order.spec /.order random.time)) + (orderT.spec /.order random.time)) (_.for [/.enum] ($enum.spec /.enum random.time)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec random.time)))) + (codecT.spec /.equivalence /.codec random.time)))) (def for_clock Test diff --git a/stdlib/source/test/lux/world/time/date.lux b/stdlib/source/test/lux/world/time/date.lux index d2a3bdc0d..aff778c3c 100644 --- a/stdlib/source/test/lux/world/time/date.lux +++ b/stdlib/source/test/lux/world/time/date.lux @@ -5,9 +5,11 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] + ["$[0]" enum]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" try (.use "[1]#[0]" functor)] ["[0]" exception]] @@ -33,11 +35,11 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence random.date)) (_.for [/.order] - ($order.spec /.order random.date)) + (orderT.spec /.order random.date)) (_.for [/.enum] ($enum.spec /.enum random.date)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec random.date)) + (codecT.spec /.equivalence /.codec random.date)) (do random.monad [expected random.date] diff --git a/stdlib/source/test/lux/world/time/day.lux b/stdlib/source/test/lux/world/time/day.lux index 5e1c3a2fe..46b3c7785 100644 --- a/stdlib/source/test/lux/world/time/day.lux +++ b/stdlib/source/test/lux/world/time/day.lux @@ -6,9 +6,11 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] + ["$[0]" enum]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" try (.use "[1]#[0]" functor)] ["[0]" exception] @@ -52,11 +54,11 @@ (_.for [/.hash] ($hash.spec /.hash ..random)) (_.for [/.order] - ($order.spec /.order ..random)) + (orderT.spec /.order ..random)) (_.for [/.enum] ($enum.spec /.enum ..random)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec ..random)) + (codecT.spec /.equivalence /.codec ..random)) (,, (with_template [<before> <current> <after>] [(_.coverage [<current>] diff --git a/stdlib/source/test/lux/world/time/duration.lux b/stdlib/source/test/lux/world/time/duration.lux index c3546fe7a..f0e17332f 100644 --- a/stdlib/source/test/lux/world/time/duration.lux +++ b/stdlib/source/test/lux/world/time/duration.lux @@ -5,10 +5,13 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" monoid] - ["$[0]" codec]]] + ["$[0]" enum]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]] + ["[0]" monoid + ["[1]T" \\test]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math @@ -29,13 +32,13 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence random.duration)) (_.for [/.order] - ($order.spec /.order random.duration)) + (orderT.spec /.order random.duration)) (_.for [/.enum] ($enum.spec /.enum random.duration)) (_.for [/.monoid] - ($monoid.spec /.equivalence /.monoid random.duration)) + (monoidT.spec /.equivalence /.monoid random.duration)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec random.duration)) + (codecT.spec /.equivalence /.codec random.duration)) (do random.monad [duration random.duration] diff --git a/stdlib/source/test/lux/world/time/instant.lux b/stdlib/source/test/lux/world/time/instant.lux index ef6773eac..eebdd4fa0 100644 --- a/stdlib/source/test/lux/world/time/instant.lux +++ b/stdlib/source/test/lux/world/time/instant.lux @@ -6,9 +6,11 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] + ["$[0]" enum]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" function] ["[0]" try (.use "[1]#[0]" functor)] @@ -38,11 +40,11 @@ (_.for [/.hash] ($hash.spec /.hash random.instant)) (_.for [/.order] - ($order.spec /.order random.instant)) + (orderT.spec /.order random.instant)) (_.for [/.enum] ($enum.spec /.enum random.instant)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec random.instant)) + (codecT.spec /.equivalence /.codec random.instant)) (do random.monad [.let [(open "/#[0]") /.equivalence] diff --git a/stdlib/source/test/lux/world/time/month.lux b/stdlib/source/test/lux/world/time/month.lux index bc095c947..20d2d070e 100644 --- a/stdlib/source/test/lux/world/time/month.lux +++ b/stdlib/source/test/lux/world/time/month.lux @@ -6,9 +6,11 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] + ["$[0]" enum]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" try (.use "[1]#[0]" functor)] ["[0]" exception] @@ -46,11 +48,11 @@ (_.for [/.hash] ($hash.spec /.hash ..random)) (_.for [/.order] - ($order.spec /.order ..random)) + (orderT.spec /.order ..random)) (_.for [/.enum] ($enum.spec /.enum ..random)) (_.for [/.codec] - ($codec.spec /.equivalence /.codec ..random)) + (codecT.spec /.equivalence /.codec ..random)) (,, (with_template [<before> <current> <after>] [(_.coverage [<current>] diff --git a/stdlib/source/test/lux/world/time/solar.lux b/stdlib/source/test/lux/world/time/solar.lux index f1da38370..5ffe2f1bd 100644 --- a/stdlib/source/test/lux/world/time/solar.lux +++ b/stdlib/source/test/lux/world/time/solar.lux @@ -4,9 +4,7 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" codec]]] + ["$[0]" equivalence]]] [control ["[0]" try] ["[0]" exception] diff --git a/stdlib/source/test/lux/world/time/year.lux b/stdlib/source/test/lux/world/time/year.lux index a635804ea..fc8504e80 100644 --- a/stdlib/source/test/lux/world/time/year.lux +++ b/stdlib/source/test/lux/world/time/year.lux @@ -4,9 +4,11 @@ [abstract [monad (.only do)] [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" codec]]] + ["$[0]" equivalence]] + ["[0]" codec + ["[1]T" \\test]] + ["[0]" order + ["[1]T" \\test]]] [control ["[0]" try] ["[0]" exception]] @@ -40,9 +42,9 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) (_.for [/.order] - ($order.spec /.order ..random)) + (orderT.spec /.order ..random)) (_.for [/.codec /.parser] - ($codec.spec /.equivalence /.codec ..random)) + (codecT.spec /.equivalence /.codec ..random)) (do random.monad [expected random.int] |