aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2022-12-22 17:21:26 -0400
committerEduardo Julian2022-12-22 17:21:26 -0400
commit6f1bf11af05bd03183fee7721ac99eca826ca041 (patch)
tree9661fdef01ebb7e4c1ead05e839d608bfab86217 /stdlib
parent4f4a96635abb04239102e4b72dc2a9c6f678dcd2 (diff)
Added some explicit machinery for the Any type.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/library/lux/data/any.lux25
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux3
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux3
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/io.lux21
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/io/context.lux6
-rw-r--r--stdlib/source/library/lux/world/finance/market/analysis.lux10
-rw-r--r--stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux15
-rw-r--r--stdlib/source/specification/lux/abstract/enum.lux32
-rw-r--r--stdlib/source/specification/lux/abstract/mix.lux25
-rw-r--r--stdlib/source/test/lux/abstract/enum.lux26
-rw-r--r--stdlib/source/test/lux/abstract/mix.lux16
-rw-r--r--stdlib/source/test/lux/abstract/monad.lux9
-rw-r--r--stdlib/source/test/lux/abstract/monad/free.lux23
-rw-r--r--stdlib/source/test/lux/data.lux3
-rw-r--r--stdlib/source/test/lux/data/any.lux33
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux7
-rw-r--r--stdlib/source/test/lux/data/collection/sequence.lux7
-rw-r--r--stdlib/source/test/lux/data/collection/tree.lux7
-rw-r--r--stdlib/source/test/lux/math/number/int.lux5
-rw-r--r--stdlib/source/test/lux/math/number/nat.lux5
-rw-r--r--stdlib/source/test/lux/math/number/rev.lux5
-rw-r--r--stdlib/source/test/lux/meta.lux14
-rw-r--r--stdlib/source/test/lux/meta/compiler.lux9
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/io.lux42
-rw-r--r--stdlib/source/test/lux/meta/type/unit.lux7
-rw-r--r--stdlib/source/test/lux/world.lux7
-rw-r--r--stdlib/source/test/lux/world/finance/market/analysis.lux50
-rw-r--r--stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux26
-rw-r--r--stdlib/source/test/lux/world/finance/trade/session.lux4
-rw-r--r--stdlib/source/test/lux/world/time.lux7
-rw-r--r--stdlib/source/test/lux/world/time/date.lux7
-rw-r--r--stdlib/source/test/lux/world/time/day.lux7
-rw-r--r--stdlib/source/test/lux/world/time/duration.lux7
-rw-r--r--stdlib/source/test/lux/world/time/instant.lux7
-rw-r--r--stdlib/source/test/lux/world/time/month.lux7
-rw-r--r--stdlib/source/test/lux/world/time/series.lux7
37 files changed, 336 insertions, 164 deletions
diff --git a/stdlib/source/library/lux/data/any.lux b/stdlib/source/library/lux/data/any.lux
new file mode 100644
index 000000000..1e5c6591f
--- /dev/null
+++ b/stdlib/source/library/lux/data/any.lux
@@ -0,0 +1,25 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [equivalence (.only Equivalence)]
+ [hash (.only Hash)]]]])
+
+(def .public any
+ Any
+ [])
+
+(def .public equivalence
+ (Equivalence Any)
+ (implementation
+ (def (= _ _)
+ true)))
+
+(def .public hash
+ (Hash Any)
+ (implementation
+ (def equivalence
+ ..equivalence)
+
+ (def (hash _)
+ 1)))
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 770614d0c..a3ca297a4 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
@@ -55,7 +55,8 @@
it))))
(def .public (translate extender lux)
- (-> extension.Extender Lux Phase)
+ (-> extension.Extender Lux
+ Phase)
(function (phase archive synthesis)
(when synthesis
(^.with_template [<tag> <translator>]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux
index b0273f3f3..297504638 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux
@@ -57,7 +57,6 @@
[reference
[variable (.only Register)]]
[meta
- [io (.only lux_context)]
[archive (.only Output Archive)
["[0]" artifact]
["[0]" registry (.only Registry)]
@@ -97,7 +96,7 @@
(def .public (class_name [module id])
(-> unit.ID Text)
- (format lux_context
+ (format "lux"
"." (%.nat version.latest)
"." (%.nat module)
"." (%.nat id)))
diff --git a/stdlib/source/library/lux/meta/compiler/meta/io.lux b/stdlib/source/library/lux/meta/compiler/meta/io.lux
index 15184122b..5231403a3 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/io.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/io.lux
@@ -4,18 +4,21 @@
[data
["[0]" text]]
[world
- [file (.only Path System)]]]])
+ ["[0]" file]]]]
+ [//
+ [archive
+ [module
+ ["[0]" descriptor]]]])
(type .public Context
- Path)
+ file.Path)
(type .public Code
Text)
-(def .public (safe system)
- (All (_ m) (-> (System m) Text Text))
- (text.replaced "/" (of system separator)))
-
-(def .public lux_context
- Context
- "lux")
+(def .public (path fs)
+ (All (_ !)
+ (-> (file.System !) descriptor.Module
+ file.Path))
+ (text.replaced .module_separator
+ (of fs separator)))
diff --git a/stdlib/source/library/lux/meta/compiler/meta/io/context.lux b/stdlib/source/library/lux/meta/compiler/meta/io/context.lux
index ab6322718..471ffe6f0 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/io/context.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/io/context.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Module Code)
+ [lux (.except Module)
[abstract
["[0]" monad (.only Monad do)]]
[control
@@ -24,7 +24,7 @@
["@" target]]
[world
["[0]" file]]]]
- ["[0]" // (.only Context Code)
+ ["[0]" // (.only Context)
["/[1]" //
[import (.only Import)]
["/[1]" // (.only Input)]
@@ -53,7 +53,7 @@
(def .public (path fs context module)
(All (_ m) (-> (file.System m) Context Module file.Path))
(|> module
- (//.safe fs)
+ (//.path fs)
(format context (of fs separator))))
(def (find_source_file fs importer contexts module extension)
diff --git a/stdlib/source/library/lux/world/finance/market/analysis.lux b/stdlib/source/library/lux/world/finance/market/analysis.lux
new file mode 100644
index 000000000..a1861eea1
--- /dev/null
+++ b/stdlib/source/library/lux/world/finance/market/analysis.lux
@@ -0,0 +1,10 @@
+(.require
+ [library
+ [lux (.except Analysis)
+ [world
+ [time
+ [series (.only Series)]]]]])
+
+(type .public (Analysis from to)
+ (-> (Series from)
+ (Series to)))
diff --git a/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux b/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux
index 8b0693abb..7f4a6ca51 100644
--- a/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux
+++ b/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux
@@ -9,12 +9,13 @@
[world
[time
["[0]" series (.only Series) (.use "[1]#[0]" functor)]]]]]
- [///
- [price (.only Price)]
+ [// (.only Analysis)
[//
- ["[0]" money]
- [trade
- ["[0]" session (.only Session)]]]])
+ [price (.only Price)]
+ [//
+ ["[0]" money]
+ [trade
+ ["[0]" session (.only Session)]]]]])
... https://en.wikipedia.org/wiki/Typical_price
(def .public (typical_price it)
@@ -68,10 +69,6 @@
#pivot_point pivot_point
#bottom_central bottom_central]))
-(type .public (Analysis from to)
- (-> (Series from)
- (Series to)))
-
(def .public analysis
(All (_ $)
(Analysis (Session $) (Central_Pivot_Range $)))
diff --git a/stdlib/source/specification/lux/abstract/enum.lux b/stdlib/source/specification/lux/abstract/enum.lux
deleted file mode 100644
index 0d367f7c0..000000000
--- a/stdlib/source/specification/lux/abstract/enum.lux
+++ /dev/null
@@ -1,32 +0,0 @@
-(.require
- [library
- [lux (.except)
- [abstract
- [monad (.only do)]
- ["[0]" order
- ["[1]T" \\test]]]
- [math
- ["[0]" random (.only Random)]]
- [test
- ["_" property (.only Test)]]]]
- [\\library
- ["[0]" /]])
-
-(def .public (spec (open "/#[0]") random)
- (All (_ a) (-> (/.Enum a) (Random a) Test))
- (do random.monad
- [sample random]
- (<| (_.for [/.Enum])
- (all _.and
- (_.for [/.order]
- (orderT.spec /#order random))
- (_.coverage [/.succ /.pred]
- (and (/#= (|> sample /#succ /#pred)
- sample)
- (/#= (|> sample /#pred /#succ)
- sample)
- (not (/#= (/#succ sample)
- sample))
- (not (/#= (/#pred sample)
- sample))))
- ))))
diff --git a/stdlib/source/specification/lux/abstract/mix.lux b/stdlib/source/specification/lux/abstract/mix.lux
deleted file mode 100644
index 614b7439f..000000000
--- a/stdlib/source/specification/lux/abstract/mix.lux
+++ /dev/null
@@ -1,25 +0,0 @@
-(.require
- [library
- [lux (.except)
- [abstract
- [monad (.only do)]
- [functor
- [\\test (.only Injection Comparison)]]]
- [math
- ["[0]" random]
- [number
- ["n" nat]]]
- [test
- ["_" property (.only Test)]]]]
- [\\library
- ["[0]" /]])
-
-(def .public (spec injection comparison (open "/#[0]"))
- (All (_ f) (-> (Injection f) (Comparison f) (/.Mix f) Test))
- (do random.monad
- [subject random.nat
- parameter random.nat]
- (<| (_.for [/.Mix])
- (_.coverage [/.mix]
- (n.= (/#mix n.+ parameter (injection subject))
- (n.+ parameter subject))))))
diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux
index 916dc04d0..dcc6b0898 100644
--- a/stdlib/source/test/lux/abstract/enum.lux
+++ b/stdlib/source/test/lux/abstract/enum.lux
@@ -2,7 +2,9 @@
[library
[lux (.except)
[abstract
- [monad (.only do)]]
+ [monad (.only do)]
+ ["[0]" order
+ ["[1]T" \\test]]]
[control
["[0]" maybe (.use "[1]#[0]" functor)]]
[data
@@ -56,3 +58,25 @@
can_be_backwards?
every_element_is_a_successor?)))
)))))
+
+(def .public (spec (open "/#[0]") random)
+ (All (_ of)
+ (-> (/.Enum of) (Random of)
+ Test))
+ (do random.monad
+ [sample random]
+ (<| (_.for [/.Enum])
+ (all _.and
+ (_.for [/.order]
+ (orderT.spec /#order random))
+
+ (_.coverage [/.succ /.pred]
+ (and (/#= (|> sample /#succ /#pred)
+ sample)
+ (/#= (|> sample /#pred /#succ)
+ sample)
+ (not (/#= (/#succ sample)
+ sample))
+ (not (/#= (/#pred sample)
+ sample))))
+ ))))
diff --git a/stdlib/source/test/lux/abstract/mix.lux b/stdlib/source/test/lux/abstract/mix.lux
index ccf941a83..de1df507c 100644
--- a/stdlib/source/test/lux/abstract/mix.lux
+++ b/stdlib/source/test/lux/abstract/mix.lux
@@ -2,7 +2,9 @@
[library
[lux (.except)
[abstract
- [monad (.only do)]]
+ [monad (.only do)]
+ [functor
+ [\\test (.only Injection Comparison)]]]
[data
[collection
["[0]" list]]]
@@ -25,3 +27,15 @@
(n.= (of list.mix mix (of n.addition composite) (of n.addition identity) samples)
(/.with_monoid n.addition list.mix samples)))
))))
+
+(def .public (spec injection comparison (open "/#[0]"))
+ (All (_ !)
+ (-> (Injection !) (Comparison !) (/.Mix !)
+ Test))
+ (do random.monad
+ [subject random.nat
+ parameter random.nat]
+ (<| (_.for [/.Mix])
+ (_.coverage [/.mix]
+ (n.= (/#mix n.+ parameter (injection subject))
+ (n.+ parameter subject))))))
diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux
index 5cf985999..1cdeab3a6 100644
--- a/stdlib/source/test/lux/abstract/monad.lux
+++ b/stdlib/source/test/lux/abstract/monad.lux
@@ -15,8 +15,7 @@
[test
["_" property (.only Test)]]]]
[\\library
- ["[0]" / (.only do)
- ["[0]" free]]]
+ ["[0]" / (.only do)]]
["[0]" /
["[1][0]" free]
["[1][0]" indexed]])
@@ -123,10 +122,6 @@
0)
(is (Identity Nat)))))
- /free.test
- (_.for [free.monad]
- (..spec /free.injection /free.comparison (is (/.Monad (free.Free List))
- (free.monad list.functor))))
-
+ (/free.test ..spec)
/indexed.test
))))
diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux
index 760acc2aa..b05075463 100644
--- a/stdlib/source/test/lux/abstract/monad/free.lux
+++ b/stdlib/source/test/lux/abstract/monad/free.lux
@@ -4,7 +4,7 @@
[abstract
[functor (.only Functor)]
[apply (.only Apply)]
- ["[0]" monad (.only do)]
+ ["[0]" monad (.only Monad do)]
["[0]" functor
["[1]T" \\test (.only Injection Comparison)]]
["[0]" apply
@@ -19,12 +19,14 @@
[\\library
["[0]" /]])
-(def .public injection
+(def injection
(Injection (/.Free List))
(|>> {/.#Pure}))
(def (interpret free)
- (All (_ a) (-> (/.Free List a) (List a)))
+ (All (_ of)
+ (-> (/.Free List of)
+ (List of)))
(when free
{/.#Pure value}
(list value)
@@ -34,17 +36,21 @@
(list#each interpret)
list.together)))
-(def .public comparison
+(def comparison
(Comparison (/.Free List))
(function (_ == left right)
(of (list.equivalence ==) =
(..interpret left)
(..interpret right))))
-(def .public test
- Test
+(def .public (test spec)
+ (-> (All (_ !)
+ (-> (Injection !) (Comparison !) (Monad !)
+ Test))
+ Test)
(<| (_.covering /._)
- (_.for [/.Free])
+ (_.for [/.Free
+ /.#Pure /.#Impure])
(all _.and
(_.for [/.functor]
(functorT.spec ..injection ..comparison (is (Functor (/.Free List))
@@ -52,4 +58,7 @@
(_.for [/.apply]
(applyT.spec ..injection ..comparison (is (Apply (/.Free List))
(/.apply list.functor))))
+ (_.for [/.monad]
+ (spec ..injection ..comparison (is (/.Monad (/.Free List))
+ (/.monad list.functor))))
)))
diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux
index ec160d576..789500e62 100644
--- a/stdlib/source/test/lux/data.lux
+++ b/stdlib/source/test/lux/data.lux
@@ -8,6 +8,7 @@
[test
["_" property (.only Test)]]]]
["[0]" /
+ ["[1][0]" any]
["[1][0]" binary]
["[1][0]" bit]
["[1][0]" color
@@ -68,6 +69,8 @@
Test
... TODO: Inline ASAP
(all _.and
+ /any.test
+
(!bundle test/0)
(!bundle test/1)
(!bundle test/2)
diff --git a/stdlib/source/test/lux/data/any.lux b/stdlib/source/test/lux/data/any.lux
new file mode 100644
index 000000000..1a8c31c44
--- /dev/null
+++ b/stdlib/source/test/lux/data/any.lux
@@ -0,0 +1,33 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]
+ [\\specification
+ ["[0]S" equivalence]
+ ["[0]S" hash]]]
+ [math
+ ["[0]" random (.only Random) (.use "[1]#[0]" monad)]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public random
+ (Random Any)
+ (random#in /.any))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [])
+ (all _.and
+ (_.for [/.equivalence]
+ (equivalenceS.spec /.equivalence ..random))
+ (_.for [/.hash]
+ (hashS.spec /.hash ..random))
+
+ (_.coverage [/.any]
+ (same? [] /.any))
+ )))
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index e2e17aa03..35b85392a 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -7,7 +7,7 @@
["[0]" functor
["[1]T" \\test (.only Injection)]]
["[0]" mix (.only Mix)
- ["$[1]" \\specification]]
+ ["[1]T" \\test]]
["[0]" monoid
["[1]T" \\test]]
[\\specification
@@ -51,7 +51,7 @@
(_.for [/.functor]
(functorT.spec ..injection /.equivalence /.functor))
(_.for [/.mix]
- ($mix.spec ..injection /.equivalence /.mix))
+ (mixT.spec ..injection /.equivalence /.mix))
)))
(def search
@@ -145,7 +145,7 @@
(function (_ $ it)
(!.each $ it))))
(_.for [!.mix]
- ($mix.spec ..injection /.equivalence
+ (mixT.spec ..injection /.equivalence
(is (Mix !.Array)
(function (_ $ init it)
(!.mix (function (_ index item output)
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index b73b76016..460565e5f 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -11,10 +11,11 @@
["[1]T" \\test]]
["[0]" monoid
["[1]T" \\test]]
+ ["[0]" mix
+ ["[1]T" \\test]]
[\\specification
["$[0]" equivalence]
- ["$[0]" hash]
- ["$[0]" mix]]]
+ ["$[0]" hash]]]
[control
["[0]" pipe]
["[0]" io]
@@ -61,7 +62,7 @@
(_.for [/.monoid]
(monoidT.spec (/.equivalence n.equivalence) /.monoid ..random))
(_.for [/.mix]
- ($mix.spec /#in /.equivalence /.mix))
+ (mixT.spec /#in /.equivalence /.mix))
(_.for [/.functor]
(functorT.spec /#in /.equivalence /.functor))
(_.for [/.apply]
diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux
index ee463e2f7..80f6d06fe 100644
--- a/stdlib/source/test/lux/data/collection/sequence.lux
+++ b/stdlib/source/test/lux/data/collection/sequence.lux
@@ -10,9 +10,10 @@
["[1]T" \\test]]
["[0]" monoid
["[1]T" \\test]]
+ ["[0]" mix
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" mix]]]
+ ["$[0]" equivalence]]]
[control
["[0]" try (.only Try)]
["[0]" exception]]
@@ -41,7 +42,7 @@
(_.for [/.monoid]
(monoidT.spec (/.equivalence n.equivalence) /.monoid (random.sequence size random.nat)))
(_.for [/.mix]
- ($mix.spec /#in /.equivalence /.mix))
+ (mixT.spec /#in /.equivalence /.mix))
(_.for [/.functor]
(functorT.spec /#in /.equivalence /.functor))
(_.for [/.apply]
diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux
index 66cdcfd6f..ee6d5a83d 100644
--- a/stdlib/source/test/lux/data/collection/tree.lux
+++ b/stdlib/source/test/lux/data/collection/tree.lux
@@ -5,9 +5,10 @@
["[0]" monad (.only do)]
["[0]" functor
["[1]T" \\test (.only Injection Comparison)]]
+ ["[0]" mix
+ ["[1]T" \\test]]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" mix]]]
+ ["$[0]" equivalence]]]
[control
["//" parser]
["[0]" try]
@@ -209,7 +210,7 @@
(of random.monad each product.right)
($equivalence.spec (/.equivalence n.equivalence))))
(_.for [/.mix]
- ($mix.spec /.leaf /.equivalence /.mix))
+ (mixT.spec /.leaf /.equivalence /.mix))
(_.for [/.functor]
(functorT.spec /.leaf /.equivalence /.functor))
diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux
index cd444a6e7..e8f8969c8 100644
--- a/stdlib/source/test/lux/math/number/int.lux
+++ b/stdlib/source/test/lux/math/number/int.lux
@@ -6,8 +6,9 @@
[\\specification
["$[0]" equivalence]
["$[0]" hash]
- ["$[0]" enum]
["$[0]" interval]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -39,7 +40,7 @@
(_.for [/.order /.<]
(orderT.spec /.order random.int))
(_.for [/.enum]
- ($enum.spec /.enum random.int))
+ (enumT.spec /.enum random.int))
(_.for [/.interval]
($interval.spec /.interval random.int))
(,, (with_template [<monoid>]
diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux
index c56fb392b..32fca4e16 100644
--- a/stdlib/source/test/lux/math/number/nat.lux
+++ b/stdlib/source/test/lux/math/number/nat.lux
@@ -6,8 +6,9 @@
[\\specification
["$[0]" equivalence]
["$[0]" hash]
- ["$[0]" enum]
["$[0]" interval]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -37,7 +38,7 @@
(_.for [/.order /.<]
(orderT.spec /.order random.nat))
(_.for [/.enum]
- ($enum.spec /.enum random.nat))
+ (enumT.spec /.enum random.nat))
(_.for [/.interval]
($interval.spec /.interval random.nat))
(,, (with_template [<composite> <monoid>]
diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux
index c570191c2..94255a012 100644
--- a/stdlib/source/test/lux/math/number/rev.lux
+++ b/stdlib/source/test/lux/math/number/rev.lux
@@ -6,8 +6,9 @@
[\\specification
["$[0]" equivalence]
["$[0]" hash]
- ["$[0]" enum]
["$[0]" interval]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -39,7 +40,7 @@
(_.for [/.order /.<]
(orderT.spec /.order random.rev))
(_.for [/.enum]
- ($enum.spec /.enum random.rev))
+ (enumT.spec /.enum random.rev))
(_.for [/.interval]
($interval.spec /.interval random.rev))
(,, (with_template [<composite> <monoid>]
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 8f693d82c..129c67b98 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -38,9 +38,9 @@
["[0]" /
["[1][0]" code]
["[1][0]" location]
- ... ["[1][0]" symbol]
- ... ["[1][0]" configuration]
- ... ["[1][0]" version]
+ ["[1][0]" symbol]
+ ["[1][0]" configuration]
+ ["[1][0]" version]
["[1][0]" type]
... ["[1][0]" macro]
... ["[1][0]" static]
@@ -55,7 +55,6 @@
... "Ruby" (.,, (.these ["[1]/[0]" ruby]))
... (.,, (.these))))]
["[1][0]" compiler
- ... ["[1]/[0]" version]
... ["[1]/[0]" reference]
... ["[1]/[0]" phase]
... ["[1]/[0]" meta
@@ -1052,9 +1051,9 @@
/code.test
/location.test
- ... /symbol.test
- ... /configuration.test
- ... /version.test
+ /symbol.test
+ /configuration.test
+ /version.test
/type.test
... /macro.test
... /static.test
@@ -1070,7 +1069,6 @@
/global.test
/compiler.test
- ... /compiler/version.test
... /compiler/reference.test
... /compiler/meta/archive.test
... /compiler/meta/cli.test
diff --git a/stdlib/source/test/lux/meta/compiler.lux b/stdlib/source/test/lux/meta/compiler.lux
index a6589b9d5..6cc006874 100644
--- a/stdlib/source/test/lux/meta/compiler.lux
+++ b/stdlib/source/test/lux/meta/compiler.lux
@@ -11,8 +11,11 @@
["[0]" /]]
["[0]" /
["[1][0]" arity]
+ ["[1][0]" version]
["[1][0]" language
- ["[1]/[0]" lux]]])
+ ["[1]/[0]" lux]]
+ ["[1][0]" meta
+ ["[1]/[0]" io]]])
(def .public test
Test
@@ -24,5 +27,9 @@
true)
/arity.test
+ /version.test
+
/language/lux.test
+
+ /meta/io.test
)))
diff --git a/stdlib/source/test/lux/meta/compiler/meta/io.lux b/stdlib/source/test/lux/meta/compiler/meta/io.lux
new file mode 100644
index 000000000..79a4bbd4d
--- /dev/null
+++ b/stdlib/source/test/lux/meta/compiler/meta/io.lux
@@ -0,0 +1,42 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [data
+ ["[0]" text]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["n" nat]]]
+ [world
+ ["[0]" file]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [/ (random.upper_cased 1)
+ .let [fs (file.mock /)]
+ module_path (random.list 3 (random.lower_cased 1))
+ .let [module (text.interposed .module_separator module_path)]])
+ (all _.and
+ (_.coverage [/.Context]
+ true)
+ (_.coverage [/.Code]
+ true)
+ (_.coverage [/.path]
+ (let [it (/.path fs module)]
+ (and (n.= (text.size module)
+ (text.size it))
+
+ (and (text.contains? .module_separator module)
+ (not (text.contains? / module)))
+
+ (and (not (text.contains? .module_separator it))
+ (text.contains? / it)))))
+ )))
diff --git a/stdlib/source/test/lux/meta/type/unit.lux b/stdlib/source/test/lux/meta/type/unit.lux
index d13ba3680..0a9979c03 100644
--- a/stdlib/source/test/lux/meta/type/unit.lux
+++ b/stdlib/source/test/lux/meta/type/unit.lux
@@ -5,8 +5,9 @@
[monad (.only do)]
[equivalence (.only Equivalence)]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" enum]]
+ ["$[0]" equivalence]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" order
["[1]T" \\test]]]
[data
@@ -46,7 +47,7 @@
(_.for [/.order]
(orderT.spec /.order (..meter 1,000)))
(_.for [/.enum]
- ($enum.spec /.enum (..meter 1,000)))
+ (enumT.spec /.enum (..meter 1,000)))
))
(with_expansions [<descriptor> (static.random code.text
diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux
index 2832e94be..cc48efe04 100644
--- a/stdlib/source/test/lux/world.lux
+++ b/stdlib/source/test/lux/world.lux
@@ -19,9 +19,7 @@
["[1]/[0]" session]]
["[1]/[0]" market
["[1]/[0]" price]
- ["[1]/[0]" analysis
- ["[1]/[0]" accumulation_distribution]
- ["[1]/[0]" pivot_point]]]]
+ ["[1]/[0]" analysis]]]
["[1][0]" net]
["[1][0]" time]
["[1][0]" locale]
@@ -41,8 +39,7 @@
/finance/money.test
/finance/trade/session.test
/finance/market/price.test
- /finance/market/analysis/accumulation_distribution.test
- /finance/market/analysis/pivot_point.test
+ /finance/market/analysis.test
/net.test
/time.test
diff --git a/stdlib/source/test/lux/world/finance/market/analysis.lux b/stdlib/source/test/lux/world/finance/market/analysis.lux
new file mode 100644
index 000000000..9332a6dd6
--- /dev/null
+++ b/stdlib/source/test/lux/world/finance/market/analysis.lux
@@ -0,0 +1,50 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["n" nat]]]
+ [world
+ [time
+ ["[0]" instant (.use "[1]#[0]" equivalence)]
+ ["[0]" duration (.use "[1]#[0]" equivalence)]
+ ["[0]" series (.only)
+ ["[1]T" \\test]]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]]
+ ["[0]" /
+ ["[1][0]" accumulation_distribution]
+ ["[1][0]" pivot_point]])
+
+(def .public (spec random it)
+ (All (_ from to)
+ (-> (Random from) (/.Analysis from to)
+ Test))
+ (do random.monad
+ [.let [expected_events 10]
+ input (seriesT.random expected_events random)
+ .let [output (it input)]]
+ (all _.and
+ (_.coverage [/.Analysis]
+ (and (instant#= (the series.#start input)
+ (the series.#start output))
+ (duration#= (the series.#interval input)
+ (the series.#interval output))
+ (n.= (series.size input)
+ (series.size output))))
+ )))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [])
+ (all _.and
+ /accumulation_distribution.test
+ (/pivot_point.test spec)
+ )))
diff --git a/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux
index bb7cd12b3..79eb95766 100644
--- a/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux
+++ b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
[abstract
[monad (.only do)]]
[math
@@ -9,19 +9,27 @@
["_" property (.only Test)]]]]
[\\library
["[0]" / (.only)
- [////
- ["[0]" money (.only)
- ["[0]" currency]]
- [trade
- ["[0]" session (.only)
- ["[1]T" \\test]]]]]])
+ [// (.only Analysis)
+ [///
+ ["[0]" money (.only)
+ ["[0]" currency]]
+ [trade
+ ["[0]" session (.only)
+ ["[1]T" \\test]]]]]]])
-(def .public test
- Test
+(def .public (test spec)
+ (-> (All (_ from to)
+ (-> (Random from) (Analysis from to)
+ Test))
+ Test)
(<| (_.covering /._)
(do [! random.monad]
[session (sessionT.random currency.usd 1000,00)])
(all _.and
+ (_.for [/.analysis]
+ (spec (sessionT.random currency.usd 1000,00)
+ /.analysis))
+
(_.coverage [/.typical_price]
(let [it (/.typical_price session)]
(and (money.<= (the session.#high session)
diff --git a/stdlib/source/test/lux/world/finance/trade/session.lux b/stdlib/source/test/lux/world/finance/trade/session.lux
index 70dde1b44..6c8be3332 100644
--- a/stdlib/source/test/lux/world/finance/trade/session.lux
+++ b/stdlib/source/test/lux/world/finance/trade/session.lux
@@ -28,13 +28,13 @@
(All (_ $)
(-> (Currency $) Nat
(Random (/.Session $))))
- (do random.monad
+ (do [! random.monad]
[p0 (moneyT.random $ max_sub_units)
p1 (moneyT.random $ max_sub_units)
p2 (moneyT.random $ max_sub_units)
p3 (moneyT.random $ max_sub_units)
bullish? random.bit
- volume random.nat]
+ volume (of ! each (n.% max_sub_units) random.nat)]
(when (list.sorted money.< (list p0 p1 p2 p3))
(list low bottom top high)
(in [/.#open (if bullish?
diff --git a/stdlib/source/test/lux/world/time.lux b/stdlib/source/test/lux/world/time.lux
index 4997cb844..bc049bc44 100644
--- a/stdlib/source/test/lux/world/time.lux
+++ b/stdlib/source/test/lux/world/time.lux
@@ -4,8 +4,9 @@
[abstract
[monad (.only do)]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" enum]]
+ ["$[0]" equivalence]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -45,7 +46,7 @@
(_.for [/.order]
(orderT.spec /.order random.time))
(_.for [/.enum]
- ($enum.spec /.enum random.time))
+ (enumT.spec /.enum random.time))
(_.for [/.codec]
(codecT.spec /.equivalence /.codec random.time))))
diff --git a/stdlib/source/test/lux/world/time/date.lux b/stdlib/source/test/lux/world/time/date.lux
index aff778c3c..306b3e252 100644
--- a/stdlib/source/test/lux/world/time/date.lux
+++ b/stdlib/source/test/lux/world/time/date.lux
@@ -4,8 +4,9 @@
[abstract
[monad (.only do)]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" enum]]
+ ["$[0]" equivalence]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -37,7 +38,7 @@
(_.for [/.order]
(orderT.spec /.order random.date))
(_.for [/.enum]
- ($enum.spec /.enum random.date))
+ (enumT.spec /.enum random.date))
(_.for [/.codec]
(codecT.spec /.equivalence /.codec random.date))
diff --git a/stdlib/source/test/lux/world/time/day.lux b/stdlib/source/test/lux/world/time/day.lux
index 46b3c7785..d0ac6f1d6 100644
--- a/stdlib/source/test/lux/world/time/day.lux
+++ b/stdlib/source/test/lux/world/time/day.lux
@@ -5,8 +5,9 @@
[monad (.only do)]
[\\specification
["$[0]" equivalence]
- ["$[0]" hash]
- ["$[0]" enum]]
+ ["$[0]" hash]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -56,7 +57,7 @@
(_.for [/.order]
(orderT.spec /.order ..random))
(_.for [/.enum]
- ($enum.spec /.enum ..random))
+ (enumT.spec /.enum ..random))
(_.for [/.codec]
(codecT.spec /.equivalence /.codec ..random))
diff --git a/stdlib/source/test/lux/world/time/duration.lux b/stdlib/source/test/lux/world/time/duration.lux
index f0e17332f..7900331b8 100644
--- a/stdlib/source/test/lux/world/time/duration.lux
+++ b/stdlib/source/test/lux/world/time/duration.lux
@@ -4,8 +4,9 @@
[abstract
[monad (.only do)]
[\\specification
- ["$[0]" equivalence]
- ["$[0]" enum]]
+ ["$[0]" equivalence]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -34,7 +35,7 @@
(_.for [/.order]
(orderT.spec /.order random.duration))
(_.for [/.enum]
- ($enum.spec /.enum random.duration))
+ (enumT.spec /.enum random.duration))
(_.for [/.monoid]
(monoidT.spec /.equivalence /.monoid random.duration))
(_.for [/.codec]
diff --git a/stdlib/source/test/lux/world/time/instant.lux b/stdlib/source/test/lux/world/time/instant.lux
index eebdd4fa0..03abc29c7 100644
--- a/stdlib/source/test/lux/world/time/instant.lux
+++ b/stdlib/source/test/lux/world/time/instant.lux
@@ -5,8 +5,9 @@
[monad (.only do)]
[\\specification
["$[0]" equivalence]
- ["$[0]" hash]
- ["$[0]" enum]]
+ ["$[0]" hash]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -42,7 +43,7 @@
(_.for [/.order]
(orderT.spec /.order random.instant))
(_.for [/.enum]
- ($enum.spec /.enum random.instant))
+ (enumT.spec /.enum random.instant))
(_.for [/.codec]
(codecT.spec /.equivalence /.codec random.instant))
diff --git a/stdlib/source/test/lux/world/time/month.lux b/stdlib/source/test/lux/world/time/month.lux
index 20d2d070e..9d1f05ab6 100644
--- a/stdlib/source/test/lux/world/time/month.lux
+++ b/stdlib/source/test/lux/world/time/month.lux
@@ -5,8 +5,9 @@
[monad (.only do)]
[\\specification
["$[0]" equivalence]
- ["$[0]" hash]
- ["$[0]" enum]]
+ ["$[0]" hash]]
+ ["[0]" enum
+ ["[1]T" \\test]]
["[0]" codec
["[1]T" \\test]]
["[0]" order
@@ -50,7 +51,7 @@
(_.for [/.order]
(orderT.spec /.order ..random))
(_.for [/.enum]
- ($enum.spec /.enum ..random))
+ (enumT.spec /.enum ..random))
(_.for [/.codec]
(codecT.spec /.equivalence /.codec ..random))
diff --git a/stdlib/source/test/lux/world/time/series.lux b/stdlib/source/test/lux/world/time/series.lux
index ef42a994e..a43c1b682 100644
--- a/stdlib/source/test/lux/world/time/series.lux
+++ b/stdlib/source/test/lux/world/time/series.lux
@@ -5,9 +5,10 @@
[monad (.only do)]
["[0]" functor
["[1]T" \\test (.only Injection)]]
+ ["[0]" mix
+ ["[1]T" \\test]]
[\\specification
- ["[0]S" equivalence]
- ["[0]S" mix]]]
+ ["[0]S" equivalence]]]
[control
["|" pipe]
["[0]" try (.use "[1]#[0]" functor)]
@@ -78,7 +79,7 @@
(_.for [/.equivalence]
(equivalenceS.spec (/.equivalence n.equivalence) (..random expected_size random.nat)))
(_.for [/.mix]
- (mixS.spec (..injection expected_start expected_interval) /.equivalence /.mix))
+ (mixT.spec (..injection expected_start expected_interval) /.equivalence /.mix))
(_.for [/.functor]
(functorT.spec (..injection expected_start expected_interval) /.equivalence /.functor))