aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
15 files changed, 150 insertions, 150 deletions
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]