aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2022-12-12 18:55:00 -0400
committerEduardo Julian2022-12-12 18:55:00 -0400
commit549cb9623c560fec165b9e88f112a406614f598e (patch)
treed085b6dddf0a7ff5078c19e0f13b48d82bee55d0 /stdlib/source/test
parentfe9a58dfcd5732ef0c5e5c4b7e85370cdc0db45a (diff)
Added accumulation/distribution oscillator.
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux/abstract/apply.lux63
-rw-r--r--stdlib/source/test/lux/abstract/comonad/free.lux6
-rw-r--r--stdlib/source/test/lux/abstract/functor.lux50
-rw-r--r--stdlib/source/test/lux/abstract/monad/free.lux10
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux10
-rw-r--r--stdlib/source/test/lux/control/concurrency/csp.lux5
-rw-r--r--stdlib/source/test/lux/control/concurrency/frp.lux10
-rw-r--r--stdlib/source/test/lux/control/concurrency/incremental.lux5
-rw-r--r--stdlib/source/test/lux/control/concurrency/stm.lux10
-rw-r--r--stdlib/source/test/lux/control/concurrency/structured.lux5
-rw-r--r--stdlib/source/test/lux/control/continuation.lux10
-rw-r--r--stdlib/source/test/lux/control/function/trampoline.lux5
-rw-r--r--stdlib/source/test/lux/control/io.lux10
-rw-r--r--stdlib/source/test/lux/control/lazy.lux10
-rw-r--r--stdlib/source/test/lux/control/maybe.lux10
-rw-r--r--stdlib/source/test/lux/control/parser.lux10
-rw-r--r--stdlib/source/test/lux/control/reader.lux10
-rw-r--r--stdlib/source/test/lux/control/region.lux10
-rw-r--r--stdlib/source/test/lux/control/security/policy.lux10
-rw-r--r--stdlib/source/test/lux/control/state.lux10
-rw-r--r--stdlib/source/test/lux/control/thread.lux10
-rw-r--r--stdlib/source/test/lux/control/try.lux10
-rw-r--r--stdlib/source/test/lux/control/writer.lux10
-rw-r--r--stdlib/source/test/lux/data.lux20
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux9
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary.lux7
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux10
-rw-r--r--stdlib/source/test/lux/data/collection/queue.lux7
-rw-r--r--stdlib/source/test/lux/data/collection/sequence.lux10
-rw-r--r--stdlib/source/test/lux/data/collection/stack.lux7
-rw-r--r--stdlib/source/test/lux/data/collection/stream.lux5
-rw-r--r--stdlib/source/test/lux/data/collection/tree.lux10
-rw-r--r--stdlib/source/test/lux/data/collection/tree/zipper.lux5
-rw-r--r--stdlib/source/test/lux/data/color.lux82
-rw-r--r--stdlib/source/test/lux/data/color/hsl.lux29
-rw-r--r--stdlib/source/test/lux/data/color/scheme.lux80
-rw-r--r--stdlib/source/test/lux/data/color/terminal.lux9
-rw-r--r--stdlib/source/test/lux/data/identity.lux10
-rw-r--r--stdlib/source/test/lux/math/random.lux10
-rw-r--r--stdlib/source/test/lux/meta.lux10
-rw-r--r--stdlib/source/test/lux/meta/compiler/phase.lux5
-rw-r--r--stdlib/source/test/lux/meta/type/check.lux10
-rw-r--r--stdlib/source/test/lux/world.lux6
-rw-r--r--stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux31
-rw-r--r--stdlib/source/test/lux/world/time/series.lux7
45 files changed, 430 insertions, 248 deletions
diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux
index 1f315c131..0dea85553 100644
--- a/stdlib/source/test/lux/abstract/apply.lux
+++ b/stdlib/source/test/lux/abstract/apply.lux
@@ -4,18 +4,23 @@
[abstract
[monad (.only do)]]
[control
- ["[0]" maybe]]
+ ["[0]" maybe]
+ ["[0]" function]]
[data
[collection
["[0]" list]]]
[math
- ["[0]" random]
+ ["[0]" random (.only Random)]
[number
["n" nat]]]
+ [meta
+ ["[0]" type]]
[test
["_" property (.only Test)]]]]
[\\library
- ["[0]" / (.only Apply)]])
+ ["[0]" /]]
+ [//
+ ["[0]T" functor (.only Injection Comparison)]])
(def .public test
Test
@@ -35,3 +40,55 @@
_
false)))
))))
+
+(def .public (spec injection comparison it)
+ (All (_ !)
+ (-> (Injection !) (Comparison !) (/.Apply !)
+ Test))
+ (<| (_.for [/.Apply])
+ (type.let [:$/1: (-> Nat Nat)])
+ (do [! random.monad]
+ [sample random.nat
+ increase (is (Random :$/1:)
+ (of ! each n.+ random.nat))
+ decrease (is (Random :$/1:)
+ (of ! each n.- random.nat))])
+ (all _.and
+ (_.for [/.functor]
+ (functorT.spec injection comparison (the /.functor it)))
+
+ (_.coverage [/.on]
+ (let [(open "/#[0]") it
+
+ identity!
+ ((comparison n.=)
+ (/#on (injection sample)
+ (injection function.identity))
+ (injection sample))
+
+ homomorphism!
+ ((comparison n.=)
+ (/#on (injection sample) (injection increase))
+ (injection (increase sample)))
+
+ interchange!
+ ((comparison n.=) (/#on (injection sample) (injection increase))
+ (/#on (injection increase) (injection (is (-> (-> Nat Nat)
+ Nat)
+ (function (_ f) (f sample))))))
+
+ composition!
+ ((comparison n.=)
+ (|> (injection (is (-> :$/1: :$/1: :$/1:)
+ function.composite))
+ (/#on (injection increase))
+ (/#on (injection decrease))
+ (/#on (injection sample)))
+ (/#on (/#on (injection sample)
+ (injection increase))
+ (injection decrease)))]
+ (and identity!
+ homomorphism!
+ interchange!
+ composition!)))
+ )))
diff --git a/stdlib/source/test/lux/abstract/comonad/free.lux b/stdlib/source/test/lux/abstract/comonad/free.lux
index bd7c6df5d..8e9d67122 100644
--- a/stdlib/source/test/lux/abstract/comonad/free.lux
+++ b/stdlib/source/test/lux/abstract/comonad/free.lux
@@ -2,10 +2,10 @@
[library
[lux (.except)
[abstract
- [functor (.only Functor)]
[comonad (.only CoMonad)]
+ ["[0]" functor (.only Functor)
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
["$[0]" comonad]]]
[control
["//" continuation]]
@@ -44,7 +44,7 @@
(_.for [/.Free])
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison (is (Functor (/.Free Stream))
+ (functorT.spec ..injection ..comparison (is (Functor (/.Free Stream))
(/.functor stream.functor))))
(_.for [/.comonad]
($comonad.spec ..injection ..comparison (is (CoMonad (/.Free Stream))
diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux
index 99e8ac055..da06b6eaf 100644
--- a/stdlib/source/test/lux/abstract/functor.lux
+++ b/stdlib/source/test/lux/abstract/functor.lux
@@ -2,10 +2,12 @@
[library
[lux (.except)
[abstract
+ [equivalence (.only Equivalence)]
[monad (.only do)]]
[control
["[0]" maybe]
- ["[0]" state]]
+ ["[0]" state]
+ ["[0]" function]]
[data
["[0]" identity]
[collection
@@ -32,7 +34,8 @@
(\\polytypic.functor .List))
(def state_functor
- (All (_ s) (Functor (state.State s)))
+ (All (_ state)
+ (Functor (state.State state)))
(\\polytypic.functor state.State))
(def identity_functor
@@ -92,3 +95,46 @@
..\\polytypic
))))
+
+(type .public (Injection !)
+ (All (_ of)
+ (-> of
+ (! of))))
+
+(type .public (Comparison !)
+ (All (_ of)
+ (-> (Equivalence of)
+ (Equivalence (! of)))))
+
+(def .public (spec injection comparison functor)
+ (All (_ !)
+ (-> (Injection !) (Comparison !) (Functor !)
+ Test))
+ (<| (do [! random.monad]
+ [sample random.nat
+ increase (of ! each n.+ random.nat)
+ decrease (of ! each n.- random.nat)])
+ (_.for [/.Functor])
+ (_.coverage [/.each]
+ (let [(open "/#[0]") functor
+
+ identity!
+ ((comparison n.=)
+ (/#each function.identity (injection sample))
+ (injection sample))
+
+ homomorphism!
+ ((comparison n.=)
+ (/#each increase (injection sample))
+ (injection (increase sample)))
+
+ composition!
+ ((comparison n.=)
+ (|> (injection sample)
+ (/#each increase)
+ (/#each decrease))
+ (|> (injection sample)
+ (/#each (|>> increase decrease))))]
+ (and identity!
+ homomorphism!
+ composition!)))))
diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux
index 26b035c75..5d786ae19 100644
--- a/stdlib/source/test/lux/abstract/monad/free.lux
+++ b/stdlib/source/test/lux/abstract/monad/free.lux
@@ -5,9 +5,11 @@
[functor (.only Functor)]
[apply (.only Apply)]
[monad (.only Monad do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[data
[collection
@@ -47,10 +49,10 @@
(_.for [/.Free])
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison (is (Functor (/.Free List))
+ (functorT.spec ..injection ..comparison (is (Functor (/.Free List))
(/.functor list.functor))))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison (is (Apply (/.Free List))
+ (applyT.spec ..injection ..comparison (is (Apply (/.Free List))
(/.apply list.functor))))
(_.for [/.monad]
($monad.spec ..injection ..comparison (is (Monad (/.Free List))
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index 1dd85aaaa..64bc1e119 100644
--- a/stdlib/source/test/lux/control/concurrency/async.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" io]]
@@ -64,9 +66,9 @@
rightE not_dummy]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/concurrency/csp.lux b/stdlib/source/test/lux/control/concurrency/csp.lux
index 502648def..057ff60c8 100644
--- a/stdlib/source/test/lux/control/concurrency/csp.lux
+++ b/stdlib/source/test/lux/control/concurrency/csp.lux
@@ -3,8 +3,9 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
["$[0]" monad]]]
[control
["[0]" io]
@@ -48,7 +49,7 @@
(_.for [/.Process]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
))
diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux
index edfcc24aa..d2d43363c 100644
--- a/stdlib/source/test/lux/control/concurrency/frp.lux
+++ b/stdlib/source/test/lux/control/concurrency/frp.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" try]
@@ -79,9 +81,9 @@
shift random.nat]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/concurrency/incremental.lux b/stdlib/source/test/lux/control/concurrency/incremental.lux
index c606cec28..380da6f50 100644
--- a/stdlib/source/test/lux/control/concurrency/incremental.lux
+++ b/stdlib/source/test/lux/control/concurrency/incremental.lux
@@ -3,8 +3,9 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
["$[0]" monad]]]
[control
["[0]" io]
@@ -65,7 +66,7 @@
(_.for [/.Computation]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.coverage [/.or]
(let [left (/.var dummy)
diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux
index e39ff2ec8..1db0c216d 100644
--- a/stdlib/source/test/lux/control/concurrency/stm.lux
+++ b/stdlib/source/test/lux/control/concurrency/stm.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
["[0]" monad (.only Monad do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" io (.only IO)]]
@@ -46,9 +48,9 @@
iterations_per_process (|> random.nat (of ! each (n.% 100)))]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/concurrency/structured.lux b/stdlib/source/test/lux/control/concurrency/structured.lux
index 2af3d8550..93b62c414 100644
--- a/stdlib/source/test/lux/control/concurrency/structured.lux
+++ b/stdlib/source/test/lux/control/concurrency/structured.lux
@@ -3,8 +3,9 @@
[lux (.except)
[abstract
["[0]" monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
["$[0]" monad]]]
[control
["[0]" maybe (.use "[1]#[0]" functor)]
@@ -72,7 +73,7 @@
(_.for [/.Async])
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux
index ce7b9d985..28f834949 100644
--- a/stdlib/source/test/lux/control/continuation.lux
+++ b/stdlib/source/test/lux/control/continuation.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[data
[collection
@@ -39,9 +41,9 @@
(_.for [/.Cont])
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/function/trampoline.lux b/stdlib/source/test/lux/control/function/trampoline.lux
index bba85385a..c9ab584a4 100644
--- a/stdlib/source/test/lux/control/function/trampoline.lux
+++ b/stdlib/source/test/lux/control/function/trampoline.lux
@@ -3,8 +3,9 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
["$[0]" monad]]]
[math
["[0]" random]
@@ -34,7 +35,7 @@
right random.nat])
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/io.lux b/stdlib/source/test/lux/control/io.lux
index cfcd17ee2..b280ca903 100644
--- a/stdlib/source/test/lux/control/io.lux
+++ b/stdlib/source/test/lux/control/io.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[math
["[0]" random]
@@ -36,9 +38,9 @@
exit_code random.int]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/lazy.lux b/stdlib/source/test/lux/control/lazy.lux
index 4e4267810..9bb545a40 100644
--- a/stdlib/source/test/lux/control/lazy.lux
+++ b/stdlib/source/test/lux/control/lazy.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]
["$[0]" equivalence]]]
[data
@@ -47,9 +49,9 @@
(_.for [/.equivalence]
($equivalence.spec (/.equivalence n.equivalence) (..lazy random.nat)))
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux
index ca86ab509..9e22f6be7 100644
--- a/stdlib/source/test/lux/control/maybe.lux
+++ b/stdlib/source/test/lux/control/maybe.lux
@@ -3,12 +3,14 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
["$[0]" equivalence]
["$[0]" hash]
["$[0]" monoid]
- ["$[0]" functor]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" io (.use "[1]#[0]" monad)]
@@ -41,9 +43,9 @@
(_.for [/.monoid]
($monoid.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat)))
(_.for [/.functor]
- ($functor.spec /#in /.equivalence /.functor))
+ (functorT.spec /#in /.equivalence /.functor))
(_.for [/.apply]
- ($apply.spec /#in /.equivalence /.apply))
+ (applyT.spec /#in /.equivalence /.apply))
(_.for [/.monad]
($monad.spec /#in /.equivalence /.monad))
diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux
index e62b889e0..3b145cec8 100644
--- a/stdlib/source/test/lux/control/parser.lux
+++ b/stdlib/source/test/lux/control/parser.lux
@@ -4,9 +4,11 @@
[abstract
[monad (.only do)]
[equivalence (.only Equivalence)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" try (.only Try)]]
@@ -344,9 +346,9 @@
(_.for [/.Parser])
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux
index 6a1185b55..7213c78aa 100644
--- a/stdlib/source/test/lux/control/reader.lux
+++ b/stdlib/source/test/lux/control/reader.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[math
["[0]" random]
@@ -37,9 +39,9 @@
factor random.nat]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux
index 2bbb8e0cb..32eed407b 100644
--- a/stdlib/source/test/lux/control/region.lux
+++ b/stdlib/source/test/lux/control/region.lux
@@ -7,9 +7,11 @@
[apply (.only Apply)]
["[0]" monad (.only Monad do)]
["[0]" enum]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" try (.only Try)]]
@@ -84,11 +86,11 @@
[expected_clean_ups (|> random.nat (of ! each (|>> (n.% 100) (n.max 1))))]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison (is (All (_ ! r)
+ (functorT.spec ..injection ..comparison (is (All (_ ! r)
(Functor (Region r (thread.Thread !))))
(/.functor thread.functor))))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison (is (All (_ ! r)
+ (applyT.spec ..injection ..comparison (is (All (_ ! r)
(Apply (Region r (thread.Thread !))))
(/.apply thread.monad))))
(_.for [/.monad]
diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux
index 82fb4c96a..014ec5104 100644
--- a/stdlib/source/test/lux/control/security/policy.lux
+++ b/stdlib/source/test/lux/control/security/policy.lux
@@ -4,9 +4,11 @@
[abstract
[hash (.only Hash)]
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[data
["[0]" text (.use "[1]#[0]" equivalence)]]
@@ -85,9 +87,9 @@
/.Safety /.Safe /.Can_Trust /.Can_Distrust]
(all _.and
(_.for [/.functor]
- ($functor.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.functor))
+ (functorT.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.functor))
(_.for [/.apply]
- ($apply.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.apply))
+ (applyT.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.apply))
(_.for [/.monad]
($monad.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.monad))))
diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux
index 98023b1f4..e66466eb0 100644
--- a/stdlib/source/test/lux/control/state.lux
+++ b/stdlib/source/test/lux/control/state.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" pipe]
@@ -72,9 +74,9 @@
[state random.nat]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection (..comparison state) /.functor))
+ (functorT.spec ..injection (..comparison state) /.functor))
(_.for [/.apply]
- ($apply.spec ..injection (..comparison state) /.apply))
+ (applyT.spec ..injection (..comparison state) /.apply))
(_.for [/.monad]
($monad.spec ..injection (..comparison state) /.monad))
)))
diff --git a/stdlib/source/test/lux/control/thread.lux b/stdlib/source/test/lux/control/thread.lux
index 8996a2382..ac265c742 100644
--- a/stdlib/source/test/lux/control/thread.lux
+++ b/stdlib/source/test/lux/control/thread.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[math
["[0]" random]
@@ -49,9 +51,9 @@
io.run!)))
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
))
diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux
index f6f000cc1..159fcfd7f 100644
--- a/stdlib/source/test/lux/control/try.lux
+++ b/stdlib/source/test/lux/control/try.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]
["$[0]" equivalence]]]
[control
@@ -51,9 +53,9 @@
(_.for [/.equivalence]
($equivalence.spec (/.equivalence n.equivalence) (..attempt random.nat)))
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux
index 4fda216e3..288859d4a 100644
--- a/stdlib/source/test/lux/control/writer.lux
+++ b/stdlib/source/test/lux/control/writer.lux
@@ -5,9 +5,11 @@
[equivalence (.only Equivalence)]
[monoid (.only Monoid)]
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" io]]
@@ -42,9 +44,9 @@
/.#log /.#value])
(all _.and
(_.for [/.functor]
- ($functor.spec (..injection text.monoid) ..comparison /.functor))
+ (functorT.spec (..injection text.monoid) ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec (..injection text.monoid) ..comparison (/.apply text.monoid)))
+ (applyT.spec (..injection text.monoid) ..comparison (/.apply text.monoid)))
(_.for [/.monad]
($monad.spec (..injection text.monoid) ..comparison (/.monad text.monoid)))
diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux
index 74432550a..ec160d576 100644
--- a/stdlib/source/test/lux/data.lux
+++ b/stdlib/source/test/lux/data.lux
@@ -10,7 +10,15 @@
["[0]" /
["[1][0]" binary]
["[1][0]" bit]
- ["[1][0]" color]
+ ["[1][0]" color
+ ["[1]/[0]" rgb]
+ ["[1]/[0]" cmyk]
+ ["[1]/[0]" hsl]
+ ["[1]/[0]" hsb]
+ ["[1]/[0]" pigment]
+ ["[1]/[0]" named]
+ ["[1]/[0]" terminal]
+ ["[1]/[0]" scheme]]
["[1][0]" identity]
["[1][0]" product]
["[1][0]" sum]
@@ -42,7 +50,6 @@
(all _.and
/binary.test
/bit.test
- /color.test
))
(def test/1
@@ -66,4 +73,13 @@
(!bundle test/2)
(!bundle ..format)
(!bundle /collection.test)
+
+ /color/rgb.test
+ /color/cmyk.test
+ /color/hsl.test
+ /color/hsb.test
+ /color/pigment.test
+ /color/named.test
+ /color/terminal.test
+ /color/scheme.test
))
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index 68ba9480c..cec353635 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -8,9 +8,10 @@
["$[1]" \\specification]]
["[0]" mix (.only Mix)
["$[1]" \\specification]]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection)]]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" functor (.only Injection)]]]
+ ["$[0]" equivalence]]]
[control
["[0]" maybe (.use "[1]#[0]" functor)]]
[data
@@ -48,7 +49,7 @@
(_.for [/.monoid]
($monoid.spec (/.equivalence n.equivalence) /.monoid (random.array size random.nat)))
(_.for [/.functor]
- ($functor.spec ..injection /.equivalence /.functor))
+ (functorT.spec ..injection /.equivalence /.functor))
(_.for [/.mix]
($mix.spec ..injection /.equivalence /.mix))
)))
@@ -140,7 +141,7 @@
(!.composite left right)))
(random.array size random.nat)))
(_.for [!.each]
- ($functor.spec ..injection /.equivalence
+ (functorT.spec ..injection /.equivalence
(function (_ $ it)
(!.each $ it))))
(_.for [!.mix]
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux
index 121fefce2..e0757bc7a 100644
--- a/stdlib/source/test/lux/data/collection/dictionary.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary.lux
@@ -4,9 +4,10 @@
[abstract
[hash (.only Hash)]
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection)]]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" functor (.only Injection)]]]
+ ["$[0]" equivalence]]]
[control
["[0]" maybe (.use "[1]#[0]" functor)]
["[0]" try]
@@ -267,7 +268,7 @@
(random.dictionary n.hash size random.nat random.nat)))
(_.for [/.functor]
- ($functor.spec ..injection /.equivalence /.functor))
+ (functorT.spec ..injection /.equivalence /.functor))
..for_dictionaries
..for_entries
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 93af39185..52e2a3183 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -4,13 +4,15 @@
[abstract
[monad (.only do)]
["[0]" enum]
+ ["[0]" functor
+ ["[1]T" \\test]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
["$[0]" equivalence]
["$[0]" hash]
["$[0]" monoid]
["$[0]" mix]
- ["$[0]" functor]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" pipe]
@@ -60,9 +62,9 @@
(_.for [/.mix]
($mix.spec /#in /.equivalence /.mix))
(_.for [/.functor]
- ($functor.spec /#in /.equivalence /.functor))
+ (functorT.spec /#in /.equivalence /.functor))
(_.for [/.apply]
- ($apply.spec /#in /.equivalence /.apply))
+ (applyT.spec /#in /.equivalence /.apply))
(_.for [/.monad]
($monad.spec /#in /.equivalence /.monad))
diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux
index 2a99ba497..56656e44a 100644
--- a/stdlib/source/test/lux/data/collection/queue.lux
+++ b/stdlib/source/test/lux/data/collection/queue.lux
@@ -3,9 +3,10 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection)]]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" functor (.only Injection)]]]
+ ["$[0]" equivalence]]]
[data
["[0]" bit (.use "[1]#[0]" equivalence)]
[collection
@@ -40,7 +41,7 @@
(_.for [/.equivalence]
($equivalence.spec (/.equivalence n.equivalence) (random.queue size random.nat)))
(_.for [/.functor]
- ($functor.spec ..injection /.equivalence /.functor))
+ (functorT.spec ..injection /.equivalence /.functor))
(_.coverage [/.of_list /.list]
(|> members /.of_list /.list
diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux
index ad34204aa..2d9703523 100644
--- a/stdlib/source/test/lux/data/collection/sequence.lux
+++ b/stdlib/source/test/lux/data/collection/sequence.lux
@@ -3,12 +3,14 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
["$[0]" equivalence]
["$[0]" monoid]
["$[0]" mix]
- ["$[0]" functor (.only Injection)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" try (.only Try)]
@@ -40,9 +42,9 @@
(_.for [/.mix]
($mix.spec /#in /.equivalence /.mix))
(_.for [/.functor]
- ($functor.spec /#in /.equivalence /.functor))
+ (functorT.spec /#in /.equivalence /.functor))
(_.for [/.apply]
- ($apply.spec /#in /.equivalence /.apply))
+ (applyT.spec /#in /.equivalence /.apply))
(_.for [/.monad]
($monad.spec /#in /.equivalence /.monad))
)))
diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux
index fab3b7d91..e18c44196 100644
--- a/stdlib/source/test/lux/data/collection/stack.lux
+++ b/stdlib/source/test/lux/data/collection/stack.lux
@@ -3,9 +3,10 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection)]]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" functor (.only Injection)]]]
+ ["$[0]" equivalence]]]
[control
["[0]" maybe]]
[data
@@ -35,7 +36,7 @@
(_.for [/.equivalence]
($equivalence.spec (/.equivalence n.equivalence) (random.stack size random.nat)))
(_.for [/.functor]
- ($functor.spec ..injection /.equivalence /.functor))
+ (functorT.spec ..injection /.equivalence /.functor))
(_.coverage [/.size]
(n.= size (/.size sample)))
diff --git a/stdlib/source/test/lux/data/collection/stream.lux b/stdlib/source/test/lux/data/collection/stream.lux
index f14f53131..75c03aa36 100644
--- a/stdlib/source/test/lux/data/collection/stream.lux
+++ b/stdlib/source/test/lux/data/collection/stream.lux
@@ -5,8 +5,9 @@
[monad (.only do)]
[equivalence (.only Equivalence)]
["[0]" enum]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
- ["$[0]" functor]
["$[0]" comonad]]]
[data
["[0]" text (.only)
@@ -53,7 +54,7 @@
cycle_next (random.list size random.nat)]
(all _.and
(_.for [/.functor]
- ($functor.spec /.repeated ..equivalence /.functor))
+ (functorT.spec /.repeated ..equivalence /.functor))
(_.for [/.comonad]
($comonad.spec /.repeated ..equivalence /.comonad))
diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux
index eef32ee7d..66cdcfd6f 100644
--- a/stdlib/source/test/lux/data/collection/tree.lux
+++ b/stdlib/source/test/lux/data/collection/tree.lux
@@ -3,10 +3,11 @@
[lux (.except)
[abstract
["[0]" monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
["$[0]" equivalence]
- ["$[0]" mix]
- ["$[0]" functor]]]
+ ["$[0]" mix]]]
[control
["//" parser]
["[0]" try]
@@ -200,7 +201,8 @@
(def .public test
Test
(<| (_.covering /._)
- (_.for [/.Tree])
+ (_.for [/.Tree
+ /.#value /.#children])
(all _.and
(_.for [/.equivalence]
(|> (..tree random.nat)
@@ -209,7 +211,7 @@
(_.for [/.mix]
($mix.spec /.leaf /.equivalence /.mix))
(_.for [/.functor]
- ($functor.spec /.leaf /.equivalence /.functor))
+ (functorT.spec /.leaf /.equivalence /.functor))
(do random.monad
[[size sample] (..tree random.nat)]
diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux
index 4325a30ef..577862dc9 100644
--- a/stdlib/source/test/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux
@@ -3,9 +3,10 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
["$[0]" equivalence]
- ["$[0]" functor]
["$[0]" comonad]]]
[control
["[0]" pipe]
@@ -167,7 +168,7 @@
(_.for [/.equivalence]
($equivalence.spec (/.equivalence n.equivalence) (of ! each (|>> product.right /.zipper) (//.tree random.nat))))
(_.for [/.functor]
- ($functor.spec (|>> tree.leaf /.zipper) /.equivalence /.functor))
+ (functorT.spec (|>> tree.leaf /.zipper) /.equivalence /.functor))
(_.for [/.comonad]
($comonad.spec (|>> tree.leaf /.zipper) /.equivalence /.comonad))
diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux
deleted file mode 100644
index 25c041fd7..000000000
--- a/stdlib/source/test/lux/data/color.lux
+++ /dev/null
@@ -1,82 +0,0 @@
-(.require
- [library
- [lux (.except)
- [abstract
- [monad (.only do)]
- [\\specification
- ["$[0]" equivalence]
- ["$[0]" hash]
- ["$[0]" monoid]]]
- [data
- [collection
- ["[0]" list]]]
- [math
- ["[0]" random (.only Random) (.use "[1]#[0]" functor)]
- [number
- ["n" nat]
- ["f" frac]
- ["r" rev]
- ["[0]" int]]]
- [test
- ["_" property (.only Test)]]]]
- [\\library
- ["[0]" / (.only)
- ["[0]" rgb]
- ["[0]" hsl]]]
- ["[0]" /
- ["[1][0]" rgb]
- ["[1][0]" cmyk]
- ["[1][0]" hsl]
- ["[1][0]" hsb]
- ["[1][0]" pigment]
- ["[1][0]" named]
- ["[1][0]" terminal]])
-
-(def .public random
- (Random /.Color)
- (random#each /.of_rgb /rgb.random))
-
-... (def palette
-... Test
-... (_.for [/.Spread /.Palette]
-... (do [! random.monad]
-... [eH (of ! each (|>> f.abs (f.% +0.9) (f.+ +0.05))
-... random.safe_frac)
-... .let [eS +0.5]
-... variations (of ! each (|>> (n.% 3) (n.+ 2)) random.nat)
-... .let [max_spread (f./ (|> variations ++ .int int.frac)
-... +1.0)
-... min_spread (f./ +2.0 max_spread)
-... spread_space (f.- min_spread max_spread)]
-... spread (of ! each (|>> f.abs (f.% spread_space) (f.+ min_spread))
-... random.safe_frac)]
-... (`` (all _.and
-... (,, (with_template [<brightness> <palette>]
-... [(_.coverage [<palette>]
-... (let [eB <brightness>
-... expected (/.of_hsb [eH eS eB])
-... palette (<palette> spread variations expected)]
-... (and (n.= variations (list.size palette))
-... (not (list.any? (of /.equivalence = expected) palette)))))]
-... [+1.0 /.analogous]
-... [+0.5 /.monochromatic]
-... ))
-... )))))
-
-(def .public test
- Test
- (<| (_.covering /._)
- (_.for [/.Color])
- (do [! random.monad]
- [expected ..random]
- (all _.and
- ... ..palette
-
- /rgb.test
- /cmyk.test
- /hsl.test
- /hsb.test
- /pigment.test
- /named.test
- /terminal.test
- ))))
diff --git a/stdlib/source/test/lux/data/color/hsl.lux b/stdlib/source/test/lux/data/color/hsl.lux
index de9c3ef8a..8563aa77b 100644
--- a/stdlib/source/test/lux/data/color/hsl.lux
+++ b/stdlib/source/test/lux/data/color/hsl.lux
@@ -49,11 +49,7 @@
((function (_ it)
(and (f.>= +0.25 it)
(f.<= +0.75 it)))))))
- ratio (|> random.safe_frac (random.only (f.>= +0.5)))
-
- eH (of ! each (|>> f.abs (f.% +0.9) (f.+ +0.05))
- random.safe_frac)
- .let [eS +0.5]])
+ ratio (|> random.safe_frac (random.only (f.>= +0.5)))])
(all _.and
(_.for [/.Value]
(all _.and
@@ -116,28 +112,5 @@
(f.- (the /.#luminance mediocre))
f.abs
(f.<= ..rgb_error_margin)))))
-
- (,, (with_template [<palette>]
- [(_.coverage [<palette>]
- (let [expected (/.of_rgb (hsb.rgb (hsb.hsb eH eS +0.5)))
- [c0 c1 c2] (<palette> expected)]
- (and (of /.equivalence = expected c0)
- (not (of /.equivalence = expected c1))
- (not (of /.equivalence = expected c2)))))]
-
- [/.triad]
- [/.clash]
- [/.split_complement]))
- (,, (with_template [<palette>]
- [(_.coverage [<palette>]
- (let [expected (/.of_rgb (hsb.rgb (hsb.hsb eH eS +0.5)))
- [c0 c1 c2 c3] (<palette> expected)]
- (and (of /.equivalence = expected c0)
- (not (of /.equivalence = expected c1))
- (not (of /.equivalence = expected c2))
- (not (of /.equivalence = expected c3)))))]
-
- [/.square]
- [/.tetradic]))
)))
)))
diff --git a/stdlib/source/test/lux/data/color/scheme.lux b/stdlib/source/test/lux/data/color/scheme.lux
new file mode 100644
index 000000000..0a66b7fc8
--- /dev/null
+++ b/stdlib/source/test/lux/data/color/scheme.lux
@@ -0,0 +1,80 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" hash]
+ ["$[0]" monoid]]]
+ [data
+ [collection
+ ["[0]" list]]]
+ [math
+ ["[0]" random (.only Random) (.use "[1]#[0]" functor)]
+ [number
+ ["n" nat]
+ ["f" frac]
+ ["r" rev]
+ ["[0]" int]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" / (.only)
+ [//
+ ["[0]" rgb (.use "[1]#[0]" equivalence)]
+ ["[0]" hsl]
+ ["[0]" hsb]]]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [expected_hue (of ! each (|>> f.abs (f.% +0.9) (f.+ +0.05))
+ random.safe_frac)
+ .let [expected_saturation +0.5]
+ variations (of ! each (|>> (n.% 3) (n.+ 2)) random.nat)
+ .let [max_spread (f./ (|> variations ++ .int int.frac)
+ +1.0)
+ min_spread (f./ +2.0 max_spread)
+ spread_space (f.- min_spread max_spread)]
+ spread (of ! each (|>> f.abs (f.% spread_space) (f.+ min_spread))
+ random.safe_frac)])
+ (`` (all _.and
+ (,, (with_template [<palette>]
+ [(_.coverage [<palette>]
+ (let [expected (hsb.rgb (hsb.hsb expected_hue expected_saturation +0.5))
+ [c0 c1 c2] (<palette> expected)]
+ (and (rgb#= expected c0)
+ (not (rgb#= expected c1))
+ (not (rgb#= expected c2)))))]
+
+ [/.triad]
+ [/.clash]
+ [/.split_complement]))
+ (,, (with_template [<palette>]
+ [(_.coverage [<palette>]
+ (let [expected (hsb.rgb (hsb.hsb expected_hue expected_saturation +0.5))
+ [c0 c1 c2 c3] (<palette> expected)]
+ (and (rgb#= expected c0)
+ (not (rgb#= expected c1))
+ (not (rgb#= expected c2))
+ (not (rgb#= expected c3)))))]
+
+ [/.square]
+ [/.tetradic]))
+ (_.for [/.Spread /.Scheme]
+ (all _.and
+ (,, (with_template [expected_brightness <palette>]
+ [(_.coverage [<palette>]
+ (let [expected (hsb.rgb (hsb.hsb expected_hue
+ expected_saturation
+ expected_brightness))
+ palette (<palette> spread variations expected)]
+ (and (n.= variations (list.size palette))
+ (not (list.any? (rgb#= expected) palette)))))]
+ [+1.0 /.analogous]
+ [+0.5 /.monochromatic]
+ ))
+ ))
+ ))))
diff --git a/stdlib/source/test/lux/data/color/terminal.lux b/stdlib/source/test/lux/data/color/terminal.lux
index 9b734041d..bcc080a1c 100644
--- a/stdlib/source/test/lux/data/color/terminal.lux
+++ b/stdlib/source/test/lux/data/color/terminal.lux
@@ -14,8 +14,7 @@
[test
["_" property (.only Test)]]]]
[\\library
- ["[0]" / (.only)
- ["/[1]" //]]]
+ ["[0]" /]]
[//
["[0]T" rgb]])
@@ -56,8 +55,8 @@
(def .public random
(Random /.Command)
(`` (all random.either
- (random#each (|>> //.of_rgb /.foreground) rgbT.random)
- (random#each (|>> //.of_rgb /.background) rgbT.random)
+ (random#each /.foreground rgbT.random)
+ (random#each /.background rgbT.random)
(,, (with_template [<command>]
[(random#in <command>)]
@@ -69,7 +68,7 @@
Test
(<| (_.covering /._)
(do [! random.monad]
- [color (random#each //.of_rgb rgbT.random)
+ [color rgbT.random
command ..random
expected_text (random.upper_cased 3)])
(_.for [/.Command])
diff --git a/stdlib/source/test/lux/data/identity.lux b/stdlib/source/test/lux/data/identity.lux
index a27cc32f7..f18f69c41 100644
--- a/stdlib/source/test/lux/data/identity.lux
+++ b/stdlib/source/test/lux/data/identity.lux
@@ -3,9 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]
["$[0]" comonad]]]
[test
@@ -28,9 +30,9 @@
(_.for [/.Identity])
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
(_.for [/.comonad]
diff --git a/stdlib/source/test/lux/math/random.lux b/stdlib/source/test/lux/math/random.lux
index e559a9c85..8f125bd7e 100644
--- a/stdlib/source/test/lux/math/random.lux
+++ b/stdlib/source/test/lux/math/random.lux
@@ -4,9 +4,11 @@
[abstract
[equivalence (.only Equivalence)]
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" maybe]]
@@ -80,9 +82,9 @@
(_.for [/.Random])
(`` (all _.and
(_.for [/.functor]
- ($functor.spec ..injection (..comparison increase,seed) /.functor))
+ (functorT.spec ..injection (..comparison increase,seed) /.functor))
(_.for [/.apply]
- ($apply.spec ..injection (..comparison increase,seed) /.apply))
+ (applyT.spec ..injection (..comparison increase,seed) /.apply))
(_.for [/.monad]
($monad.spec ..injection (..comparison increase,seed) /.monad))
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 97eb1e7f4..2a2787429 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -4,9 +4,11 @@
[abstract
[equivalence (.only Equivalence)]
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" maybe]
@@ -1018,9 +1020,9 @@
... .#host []]]]
... (all _.and
... (_.for [/.functor]
- ... ($functor.spec ..injection (..comparison expected_lux) /.functor))
+ ... (functorT.spec ..injection (..comparison expected_lux) /.functor))
... (_.for [/.apply]
- ... ($apply.spec ..injection (..comparison expected_lux) /.apply))
+ ... (applyT.spec ..injection (..comparison expected_lux) /.apply))
... (_.for [/.monad]
... ($monad.spec ..injection (..comparison expected_lux) /.monad))
diff --git a/stdlib/source/test/lux/meta/compiler/phase.lux b/stdlib/source/test/lux/meta/compiler/phase.lux
index 355f02299..692058872 100644
--- a/stdlib/source/test/lux/meta/compiler/phase.lux
+++ b/stdlib/source/test/lux/meta/compiler/phase.lux
@@ -3,8 +3,9 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
["$[0]" monad]]]
[control
["[0]" pipe]
@@ -141,7 +142,7 @@
expected random.int]
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection (..comparison state) /.functor))
+ (functorT.spec ..injection (..comparison state) /.functor))
(_.for [/.monad]
($monad.spec ..injection (..comparison state) /.monad))
diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux
index f82d5b74e..18aef928a 100644
--- a/stdlib/source/test/lux/meta/type/check.lux
+++ b/stdlib/source/test/lux/meta/type/check.lux
@@ -3,9 +3,11 @@
[lux (.except symbol type)
[abstract
["[0]" monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" apply
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" functor (.only Injection Comparison)]
- ["$[0]" apply]
["$[0]" monad]]]
[control
["[0]" pipe]
@@ -111,9 +113,9 @@
Test
(all _.and
(_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
+ (functorT.spec ..injection ..comparison /.functor))
(_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
+ (applyT.spec ..injection ..comparison /.apply))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
))
diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux
index bf9ff3c7f..3793d49ee 100644
--- a/stdlib/source/test/lux/world.lux
+++ b/stdlib/source/test/lux/world.lux
@@ -16,7 +16,10 @@
["[1][0]" finance
["[1]/[0]" money]
["[1]/[0]" trade
- ["[1]/[0]" session]]]
+ ["[1]/[0]" session]]
+ ["[1]/[0]" market
+ ["[1]/[0]" analysis
+ ["[1]/[0]" accumulation_distribution]]]]
["[1][0]" net]
["[1][0]" time]
["[1][0]" locale]
@@ -35,6 +38,7 @@
/finance/money.test
/finance/trade/session.test
+ /finance/market/analysis/accumulation_distribution.test
/net.test
/time.test
diff --git a/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux
new file mode 100644
index 000000000..74b502140
--- /dev/null
+++ b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux
@@ -0,0 +1,31 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["f" frac]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" / (.only)
+ [////
+ [money
+ ["[0]" currency]]]]]
+ [////
+ [trade
+ ["[0]T" session]]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [session (sessionT.random currency.usd)])
+ (all _.and
+ (_.coverage [/.oscillation]
+ (let [it (/.oscillation session)]
+ (and (f.<= +1.0 it)
+ (f.>= -1.0 it))))
+ )))
diff --git a/stdlib/source/test/lux/world/time/series.lux b/stdlib/source/test/lux/world/time/series.lux
index 47432df08..ef42a994e 100644
--- a/stdlib/source/test/lux/world/time/series.lux
+++ b/stdlib/source/test/lux/world/time/series.lux
@@ -3,10 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection)]]
[\\specification
["[0]S" equivalence]
- ["[0]S" mix]
- ["[0]S" functor (.only Injection)]]]
+ ["[0]S" mix]]]
[control
["|" pipe]
["[0]" try (.use "[1]#[0]" functor)]
@@ -79,7 +80,7 @@
(_.for [/.mix]
(mixS.spec (..injection expected_start expected_interval) /.equivalence /.mix))
(_.for [/.functor]
- (functorS.spec (..injection expected_start expected_interval) /.equivalence /.functor))
+ (functorT.spec (..injection expected_start expected_interval) /.equivalence /.functor))
(_.coverage [/.size]
(n.= expected_size