aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/type
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/type')
-rw-r--r--stdlib/source/test/lux/type/abstract.lux104
-rw-r--r--stdlib/source/test/lux/type/check.lux572
-rw-r--r--stdlib/source/test/lux/type/dynamic.lux46
-rw-r--r--stdlib/source/test/lux/type/implicit.lux54
-rw-r--r--stdlib/source/test/lux/type/poly.lux28
-rw-r--r--stdlib/source/test/lux/type/poly/equivalence.lux32
-rw-r--r--stdlib/source/test/lux/type/poly/json.lux30
-rw-r--r--stdlib/source/test/lux/type/quotient.lux46
-rw-r--r--stdlib/source/test/lux/type/refinement.lux108
-rw-r--r--stdlib/source/test/lux/type/resource.lux236
-rw-r--r--stdlib/source/test/lux/type/unit.lux194
-rw-r--r--stdlib/source/test/lux/type/variance.lux48
12 files changed, 749 insertions, 749 deletions
diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux
index 27c6e97c4..7e3ce6884 100644
--- a/stdlib/source/test/lux/type/abstract.lux
+++ b/stdlib/source/test/lux/type/abstract.lux
@@ -59,55 +59,55 @@
(do random.monad
[expected_foo (random.ascii/lower 5)
expected_bar random.nat]
- ($_ _.and
- (_.cover [/.abstraction]
- (and (exec (is (g!Foo Text)
- (/.abstraction g!Foo expected_foo))
- true)
- (exec (is (g!Bar Text)
- (/.abstraction expected_bar))
- true)))
- (_.cover [/.representation]
- (and (|> expected_foo
- (/.abstraction g!Foo)
- (is (g!Foo Bit))
- (/.representation g!Foo)
- (text#= expected_foo))
- (|> (/.abstraction expected_bar)
- (is (g!Bar Bit))
- /.representation
- (n.= expected_bar))))
- (_.cover [/.transmutation]
- (and (exec (|> expected_foo
- (/.abstraction g!Foo)
- (is (g!Foo .Macro))
- (/.transmutation g!Foo)
- (is (g!Foo .Lux)))
- true)
- (exec (|> (/.abstraction expected_bar)
- (is (g!Bar .Macro))
- /.transmutation
- (is (g!Bar .Lux)))
- true)))
- (_.cover [/.pattern]
- (and (let [(/.pattern g!Foo actual_foo)
- (is (g!Foo .Module)
- (/.abstraction g!Foo expected_foo))]
- (text#= expected_foo actual_foo))
- (let [(/.pattern actual_bar)
- (is (g!Bar .Module)
- (/.abstraction expected_bar))]
- (n.= expected_bar actual_bar))))
- (_.for [/.Frame]
- ($_ _.and
- (_.cover [/.current]
- (text#= (template.text [g!Bar])
- (..current)))
- (_.cover [/.specific]
- (text#= (template.text [g!Foo])
- (..specific)))
- (_.cover [/.no_active_frames]
- (and no_current!
- no_specific!))
- ))
- )))))))))
+ (all _.and
+ (_.cover [/.abstraction]
+ (and (exec (is (g!Foo Text)
+ (/.abstraction g!Foo expected_foo))
+ true)
+ (exec (is (g!Bar Text)
+ (/.abstraction expected_bar))
+ true)))
+ (_.cover [/.representation]
+ (and (|> expected_foo
+ (/.abstraction g!Foo)
+ (is (g!Foo Bit))
+ (/.representation g!Foo)
+ (text#= expected_foo))
+ (|> (/.abstraction expected_bar)
+ (is (g!Bar Bit))
+ /.representation
+ (n.= expected_bar))))
+ (_.cover [/.transmutation]
+ (and (exec (|> expected_foo
+ (/.abstraction g!Foo)
+ (is (g!Foo .Macro))
+ (/.transmutation g!Foo)
+ (is (g!Foo .Lux)))
+ true)
+ (exec (|> (/.abstraction expected_bar)
+ (is (g!Bar .Macro))
+ /.transmutation
+ (is (g!Bar .Lux)))
+ true)))
+ (_.cover [/.pattern]
+ (and (let [(/.pattern g!Foo actual_foo)
+ (is (g!Foo .Module)
+ (/.abstraction g!Foo expected_foo))]
+ (text#= expected_foo actual_foo))
+ (let [(/.pattern actual_bar)
+ (is (g!Bar .Module)
+ (/.abstraction expected_bar))]
+ (n.= expected_bar actual_bar))))
+ (_.for [/.Frame]
+ (all _.and
+ (_.cover [/.current]
+ (text#= (template.text [g!Bar])
+ (..current)))
+ (_.cover [/.specific]
+ (text#= (template.text [g!Foo])
+ (..specific)))
+ (_.cover [/.no_active_frames]
+ (and no_current!
+ no_specific!))
+ ))
+ )))))))))
diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux
index fab083c9e..07d647d77 100644
--- a/stdlib/source/test/lux/type/check.lux
+++ b/stdlib/source/test/lux/type/check.lux
@@ -58,13 +58,13 @@
random_id)))
random_quantified (random.either (random#each (|>> {.#UnivQ}) quantifiedG)
(random#each (|>> {.#ExQ}) quantifiedG))]
- ($_ random.either
- (random#each (|>> {.#Primitive}) (random.and ..short (random#in (list))))
- random_pair
- random_id
- random_quantified
- (random#each (|>> {.#Named}) (random.and ..symbol (type' 0)))
- )))))
+ (all random.either
+ (random#each (|>> {.#Primitive}) (random.and ..short (random#in (list))))
+ random_pair
+ random_id
+ random_quantified
+ (random#each (|>> {.#Named}) (random.and ..symbol (type' 0)))
+ )))))
(def: type
(Random Type)
@@ -107,14 +107,14 @@
(def: polymorphism
Test
- ($_ _.and
- (_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
- (_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
- (_.for [/.monad]
- ($monad.spec ..injection ..comparison /.monad))
- ))
+ (all _.and
+ (_.for [/.functor]
+ ($functor.spec ..injection ..comparison /.functor))
+ (_.for [/.apply]
+ ($apply.spec ..injection ..comparison /.apply))
+ (_.for [/.monad]
+ ($monad.spec ..injection ..comparison /.monad))
+ ))
(def: (primitive_type parameters)
(-> Nat (Random Type))
@@ -135,233 +135,233 @@
[left ..clean_type
right ..clean_type
ex random.nat]
- ($_ _.and
- (do random.monad
- [expected (random.ascii/upper 10)]
- (_.cover [/.failure]
- (case (/.result /.fresh_context
- (is (/.Check Any)
- (/.failure expected)))
- {try.#Success _} false
- {try.#Failure actual} (same? expected actual))))
- (do random.monad
- [expected (random.ascii/upper 10)]
- (_.cover [/.assertion]
- (and (case (/.result /.fresh_context
- (is (/.Check Any)
- (/.assertion expected true)))
- {try.#Success _} true
- {try.#Failure actual} false)
- (case (/.result /.fresh_context (/.assertion expected false))
- {try.#Success _} false
- {try.#Failure actual} (same? expected actual)))))
- (_.cover [/.except]
- (case (/.result /.fresh_context
- (is (/.Check Any)
- (/.except ..yolo [])))
- {try.#Success _} false
- {try.#Failure error} (exception.match? ..yolo error)))
- (let [scenario (is (-> (-> Text Bit) Type Type Bit)
- (function (_ ? <left> <right>)
- (and (|> (/.check <left> <right>)
- (is (/.Check Any))
- (/.result /.fresh_context)
- (pipe.case {try.#Failure error} (? error)
- {try.#Success _} false))
- (|> (/.check <right> <left>)
- (is (/.Check Any))
- (/.result /.fresh_context)
- (pipe.case {try.#Failure error} (? error)
- {try.#Success _} false)))))]
- ($_ _.and
- (_.cover [/.type_check_failed]
- (let [scenario (scenario (exception.match? /.type_check_failed))]
- (and (scenario (Tuple left right) left)
- (scenario (Tuple left right) (Or left right))
- (scenario (Tuple left right) (-> left right))
- (scenario (Tuple left right) {.#Ex ex})
-
- (scenario (Or left right) left)
- (scenario (Or left right) (-> left right))
- (scenario (Or left right) {.#Ex ex})
-
- (scenario (-> left right) left)
- (scenario (-> left right) {.#Ex ex})
-
- (scenario {.#Ex ex} left)
- )))
- (_.cover [/.invalid_type_application]
- (let [scenario (scenario (text.contains? (the exception.#label /.invalid_type_application)))]
- (scenario {.#Apply left right} left)))))
- )))
+ (all _.and
+ (do random.monad
+ [expected (random.ascii/upper 10)]
+ (_.cover [/.failure]
+ (case (/.result /.fresh_context
+ (is (/.Check Any)
+ (/.failure expected)))
+ {try.#Success _} false
+ {try.#Failure actual} (same? expected actual))))
+ (do random.monad
+ [expected (random.ascii/upper 10)]
+ (_.cover [/.assertion]
+ (and (case (/.result /.fresh_context
+ (is (/.Check Any)
+ (/.assertion expected true)))
+ {try.#Success _} true
+ {try.#Failure actual} false)
+ (case (/.result /.fresh_context (/.assertion expected false))
+ {try.#Success _} false
+ {try.#Failure actual} (same? expected actual)))))
+ (_.cover [/.except]
+ (case (/.result /.fresh_context
+ (is (/.Check Any)
+ (/.except ..yolo [])))
+ {try.#Success _} false
+ {try.#Failure error} (exception.match? ..yolo error)))
+ (let [scenario (is (-> (-> Text Bit) Type Type Bit)
+ (function (_ ? <left> <right>)
+ (and (|> (/.check <left> <right>)
+ (is (/.Check Any))
+ (/.result /.fresh_context)
+ (pipe.case {try.#Failure error} (? error)
+ {try.#Success _} false))
+ (|> (/.check <right> <left>)
+ (is (/.Check Any))
+ (/.result /.fresh_context)
+ (pipe.case {try.#Failure error} (? error)
+ {try.#Success _} false)))))]
+ (all _.and
+ (_.cover [/.type_check_failed]
+ (let [scenario (scenario (exception.match? /.type_check_failed))]
+ (and (scenario (Tuple left right) left)
+ (scenario (Tuple left right) (Or left right))
+ (scenario (Tuple left right) (-> left right))
+ (scenario (Tuple left right) {.#Ex ex})
+
+ (scenario (Or left right) left)
+ (scenario (Or left right) (-> left right))
+ (scenario (Or left right) {.#Ex ex})
+
+ (scenario (-> left right) left)
+ (scenario (-> left right) {.#Ex ex})
+
+ (scenario {.#Ex ex} left)
+ )))
+ (_.cover [/.invalid_type_application]
+ (let [scenario (scenario (text.contains? (the exception.#label /.invalid_type_application)))]
+ (scenario {.#Apply left right} left)))))
+ )))
(def: var
Test
(<| (_.for [/.Var])
- ($_ _.and
- (_.cover [/.var]
- (case (/.result /.fresh_context
- (do /.monad
- [[var_id var_type] /.var]
- (in (type#= var_type {.#Var var_id}))))
- {try.#Success verdict} verdict
- {try.#Failure error} false))
- (do random.monad
- [nominal (random.ascii/upper 10)]
- (_.cover [/.bind]
- (case (/.result /.fresh_context
- (do /.monad
- [[var_id var_type] /.var
- _ (/.bind {.#Primitive nominal (list)}
- var_id)]
- (in true)))
- {try.#Success _} true
- {try.#Failure error} false)))
- (do random.monad
- [nominal (random.ascii/upper 10)]
- (_.cover [/.bound?]
- (and (|> (do /.monad
- [[var_id var_type] /.var
- pre (/.bound? var_id)
- _ (/.bind {.#Primitive nominal (list)}
- var_id)
- post (/.bound? var_id)]
- (in (and (not pre)
- post)))
- (/.result /.fresh_context)
- (try.else false))
- (|> (do /.monad
- [[var_id var/0] /.var
- pre (/.bound? var_id)
- [_ var/1] /.var
- _ (/.check var/0 var/1)
- post (/.bound? var_id)]
- (in (and (not pre)
- (not post))))
- (/.result /.fresh_context)
- (try.else false)))))
- (do random.monad
- [nominal (random.ascii/upper 10)]
- (_.cover [/.cannot_rebind_var]
- (case (/.result /.fresh_context
- (do /.monad
- [[var_id var_type] /.var
- _ (/.bind {.#Primitive nominal (list)}
- var_id)]
- (/.bind {.#Primitive nominal (list)}
- var_id)))
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.cannot_rebind_var error))))
- (do random.monad
- [nominal (random.ascii/upper 10)
- var_id random.nat]
- (_.cover [/.unknown_type_var]
- (case (/.result /.fresh_context
- (/.bind {.#Primitive nominal (list)}
- var_id))
- {try.#Success _}
- false
+ (all _.and
+ (_.cover [/.var]
+ (case (/.result /.fresh_context
+ (do /.monad
+ [[var_id var_type] /.var]
+ (in (type#= var_type {.#Var var_id}))))
+ {try.#Success verdict} verdict
+ {try.#Failure error} false))
+ (do random.monad
+ [nominal (random.ascii/upper 10)]
+ (_.cover [/.bind]
+ (case (/.result /.fresh_context
+ (do /.monad
+ [[var_id var_type] /.var
+ _ (/.bind {.#Primitive nominal (list)}
+ var_id)]
+ (in true)))
+ {try.#Success _} true
+ {try.#Failure error} false)))
+ (do random.monad
+ [nominal (random.ascii/upper 10)]
+ (_.cover [/.bound?]
+ (and (|> (do /.monad
+ [[var_id var_type] /.var
+ pre (/.bound? var_id)
+ _ (/.bind {.#Primitive nominal (list)}
+ var_id)
+ post (/.bound? var_id)]
+ (in (and (not pre)
+ post)))
+ (/.result /.fresh_context)
+ (try.else false))
+ (|> (do /.monad
+ [[var_id var/0] /.var
+ pre (/.bound? var_id)
+ [_ var/1] /.var
+ _ (/.check var/0 var/1)
+ post (/.bound? var_id)]
+ (in (and (not pre)
+ (not post))))
+ (/.result /.fresh_context)
+ (try.else false)))))
+ (do random.monad
+ [nominal (random.ascii/upper 10)]
+ (_.cover [/.cannot_rebind_var]
+ (case (/.result /.fresh_context
+ (do /.monad
+ [[var_id var_type] /.var
+ _ (/.bind {.#Primitive nominal (list)}
+ var_id)]
+ (/.bind {.#Primitive nominal (list)}
+ var_id)))
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.cannot_rebind_var error))))
+ (do random.monad
+ [nominal (random.ascii/upper 10)
+ var_id random.nat]
+ (_.cover [/.unknown_type_var]
+ (case (/.result /.fresh_context
+ (/.bind {.#Primitive nominal (list)}
+ var_id))
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.unknown_type_var error))))
+ (do random.monad
+ [nominal (random.ascii/upper 10)
+ .let [expected {.#Primitive nominal (list)}]]
+ (_.cover [/.peek]
+ (and (|> (do /.monad
+ [[var_id var_type] /.var]
+ (/.peek var_id))
+ (/.result /.fresh_context)
+ (pipe.case {try.#Success {.#None}} true
+ _ false))
+ (|> (do /.monad
+ [[var_id var/0] /.var
+ [_ var/1] /.var
+ _ (/.check var/0 var/1)]
+ (/.peek var_id))
+ (/.result /.fresh_context)
+ (pipe.case {try.#Success {.#None}} true
+ _ false))
+ (|> (do /.monad
+ [[var_id var_type] /.var
+ _ (/.bind expected var_id)]
+ (/.peek var_id))
+ (/.result /.fresh_context)
+ (pipe.case {try.#Success {.#Some actual}}
+ (same? expected actual)
+
+ _
+ false)))))
+ (do random.monad
+ [nominal (random.ascii/upper 10)
+ .let [expected {.#Primitive nominal (list)}]]
+ (_.cover [/.read]
+ (case (/.result /.fresh_context
+ (do /.monad
+ [[var_id var_type] /.var
+ _ (/.bind expected var_id)]
+ (/.read var_id)))
+ {try.#Success actual}
+ (same? expected actual)
+
+ _
+ false)))
+ (do random.monad
+ [nominal (random.ascii/upper 10)
+ .let [expected {.#Primitive nominal (list)}]]
+ (_.cover [/.unbound_type_var]
+ (case (/.result /.fresh_context
+ (do /.monad
+ [[var_id var_type] /.var]
+ (/.read var_id)))
+ {try.#Failure error}
+ (exception.match? /.unbound_type_var error)
+
+ _
+ false)))
+ )))
+
+(def: context
+ Test
+ (all _.and
+ (_.cover [/.fresh_context]
+ (and (n.= 0 (the .#var_counter /.fresh_context))
+ (n.= 0 (the .#ex_counter /.fresh_context))
+ (list.empty? (the .#var_bindings /.fresh_context))))
+ (_.cover [/.context]
+ (and (case (/.result /.fresh_context /.context)
+ {try.#Success actual}
+ (same? /.fresh_context actual)
{try.#Failure error}
- (exception.match? /.unknown_type_var error))))
- (do random.monad
- [nominal (random.ascii/upper 10)
- .let [expected {.#Primitive nominal (list)}]]
- (_.cover [/.peek]
- (and (|> (do /.monad
- [[var_id var_type] /.var]
- (/.peek var_id))
- (/.result /.fresh_context)
- (pipe.case {try.#Success {.#None}} true
- _ false))
- (|> (do /.monad
- [[var_id var/0] /.var
- [_ var/1] /.var
- _ (/.check var/0 var/1)]
- (/.peek var_id))
- (/.result /.fresh_context)
- (pipe.case {try.#Success {.#None}} true
- _ false))
- (|> (do /.monad
- [[var_id var_type] /.var
- _ (/.bind expected var_id)]
- (/.peek var_id))
- (/.result /.fresh_context)
- (pipe.case {try.#Success {.#Some actual}}
- (same? expected actual)
-
- _
- false)))))
- (do random.monad
- [nominal (random.ascii/upper 10)
- .let [expected {.#Primitive nominal (list)}]]
- (_.cover [/.read]
+ false)
(case (/.result /.fresh_context
(do /.monad
- [[var_id var_type] /.var
- _ (/.bind expected var_id)]
- (/.read var_id)))
+ [_ /.var]
+ /.context))
{try.#Success actual}
- (same? expected actual)
+ (and (n.= 1 (the .#var_counter actual))
+ (n.= 0 (the .#ex_counter actual))
+ (n.= 1 (list.size (the .#var_bindings actual))))
- _
- false)))
- (do random.monad
- [nominal (random.ascii/upper 10)
- .let [expected {.#Primitive nominal (list)}]]
- (_.cover [/.unbound_type_var]
- (case (/.result /.fresh_context
- (do /.monad
- [[var_id var_type] /.var]
- (/.read var_id)))
{try.#Failure error}
- (exception.match? /.unbound_type_var error)
-
- _
false)))
- )))
-
-(def: context
- Test
- ($_ _.and
- (_.cover [/.fresh_context]
- (and (n.= 0 (the .#var_counter /.fresh_context))
- (n.= 0 (the .#ex_counter /.fresh_context))
- (list.empty? (the .#var_bindings /.fresh_context))))
- (_.cover [/.context]
- (and (case (/.result /.fresh_context /.context)
- {try.#Success actual}
- (same? /.fresh_context actual)
-
- {try.#Failure error}
- false)
- (case (/.result /.fresh_context
- (do /.monad
- [_ /.var]
- /.context))
- {try.#Success actual}
- (and (n.= 1 (the .#var_counter actual))
- (n.= 0 (the .#ex_counter actual))
- (n.= 1 (list.size (the .#var_bindings actual))))
-
- {try.#Failure error}
- false)))
- (_.cover [/.existential]
- (case (/.result /.fresh_context
- (do /.monad
- [_ /.existential]
- /.context))
- {try.#Success actual}
- (and (n.= 0 (the .#var_counter actual))
- (n.= 1 (the .#ex_counter actual))
- (n.= 0 (list.size (the .#var_bindings actual))))
-
- {try.#Failure error}
- false))
- ))
+ (_.cover [/.existential]
+ (case (/.result /.fresh_context
+ (do /.monad
+ [_ /.existential]
+ /.context))
+ {try.#Success actual}
+ (and (n.= 0 (the .#var_counter actual))
+ (n.= 1 (the .#ex_counter actual))
+ (n.= 0 (list.size (the .#var_bindings actual))))
+
+ {try.#Failure error}
+ false))
+ ))
(def: succeeds?
(All (_ a) (-> (/.Check a) Bit))
@@ -685,46 +685,46 @@
(Random (-> Type Type))
(random.rec
(function (_ dirty_type)
- (`` ($_ random.either
- (random#each (function (_ id)
- (function.constant {.#Ex id}))
- random.nat)
- (do random.monad
- [module (random.ascii/upper 10)
- short (random.ascii/upper 10)
- anonymousT dirty_type]
- (in (function (_ holeT)
- {.#Named [module short] (anonymousT holeT)})))
- (~~ (template [<tag>]
- [(do random.monad
- [leftT dirty_type
- rightT dirty_type]
- (in (function (_ holeT)
- {<tag> (leftT holeT) (rightT holeT)})))]
-
- [.#Sum]
- [.#Product]
- [.#Function]
- [.#Apply]
- ))
- (do [! random.monad]
- [name (random.ascii/upper 10)
- parameterT dirty_type]
- (in (function (_ holeT)
- {.#Primitive name (list (parameterT holeT))})))
- (~~ (template [<tag>]
- [(do [! random.monad]
- [funcT dirty_type
- argT dirty_type
- body random.nat]
- (in (function (_ holeT)
- {<tag> (list (funcT holeT) (argT holeT))
- {.#Parameter body}})))]
-
- [.#UnivQ]
- [.#ExQ]
- ))
- )))))
+ (`` (all random.either
+ (random#each (function (_ id)
+ (function.constant {.#Ex id}))
+ random.nat)
+ (do random.monad
+ [module (random.ascii/upper 10)
+ short (random.ascii/upper 10)
+ anonymousT dirty_type]
+ (in (function (_ holeT)
+ {.#Named [module short] (anonymousT holeT)})))
+ (~~ (template [<tag>]
+ [(do random.monad
+ [leftT dirty_type
+ rightT dirty_type]
+ (in (function (_ holeT)
+ {<tag> (leftT holeT) (rightT holeT)})))]
+
+ [.#Sum]
+ [.#Product]
+ [.#Function]
+ [.#Apply]
+ ))
+ (do [! random.monad]
+ [name (random.ascii/upper 10)
+ parameterT dirty_type]
+ (in (function (_ holeT)
+ {.#Primitive name (list (parameterT holeT))})))
+ (~~ (template [<tag>]
+ [(do [! random.monad]
+ [funcT dirty_type
+ argT dirty_type
+ body random.nat]
+ (in (function (_ holeT)
+ {<tag> (list (funcT holeT) (argT holeT))
+ {.#Parameter body}})))]
+
+ [.#UnivQ]
+ [.#ExQ]
+ ))
+ )))))
(def: clean
Test
@@ -882,19 +882,19 @@
Test
(<| (_.covering /._)
(_.for [/.Check])
- ($_ _.and
- ..polymorphism
- (do random.monad
- [expected random.nat]
- (_.cover [/.result]
- (case (/.result /.fresh_context
- (# /.monad in expected))
- {try.#Success actual} (same? expected actual)
- {try.#Failure error} false)))
- ..error_handling
- ..var
- ..context
- ..check
- ..clean
- ..for_subsumption
- )))
+ (all _.and
+ ..polymorphism
+ (do random.monad
+ [expected random.nat]
+ (_.cover [/.result]
+ (case (/.result /.fresh_context
+ (# /.monad in expected))
+ {try.#Success actual} (same? expected actual)
+ {try.#Failure error} false)))
+ ..error_handling
+ ..var
+ ..context
+ ..check
+ ..clean
+ ..for_subsumption
+ )))
diff --git a/stdlib/source/test/lux/type/dynamic.lux b/stdlib/source/test/lux/type/dynamic.lux
index e5c31c177..d180815e5 100644
--- a/stdlib/source/test/lux/type/dynamic.lux
+++ b/stdlib/source/test/lux/type/dynamic.lux
@@ -23,26 +23,26 @@
(_.for [/.Dynamic])
(do random.monad
[expected random.nat]
- ($_ _.and
- (_.cover [/.dynamic /.static]
- (case (/.static Nat (/.dynamic expected))
- {try.#Success actual}
- (n.= expected actual)
-
- {try.#Failure _}
- false))
- (_.cover [/.wrong_type]
- (case (/.static Text (/.dynamic expected))
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.wrong_type error)))
- (_.cover [/.format]
- (case (/.format (/.dynamic expected))
- {try.#Success actual}
- (text#= (%.nat expected) actual)
-
- {try.#Failure _}
- false))
- ))))
+ (all _.and
+ (_.cover [/.dynamic /.static]
+ (case (/.static Nat (/.dynamic expected))
+ {try.#Success actual}
+ (n.= expected actual)
+
+ {try.#Failure _}
+ false))
+ (_.cover [/.wrong_type]
+ (case (/.static Text (/.dynamic expected))
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.wrong_type error)))
+ (_.cover [/.format]
+ (case (/.format (/.dynamic expected))
+ {try.#Success actual}
+ (text#= (%.nat expected) actual)
+
+ {try.#Failure _}
+ false))
+ ))))
diff --git a/stdlib/source/test/lux/type/implicit.lux b/stdlib/source/test/lux/type/implicit.lux
index 38e683a02..8fa84731b 100644
--- a/stdlib/source/test/lux/type/implicit.lux
+++ b/stdlib/source/test/lux/type/implicit.lux
@@ -33,32 +33,32 @@
left random.nat
right random.nat]
- ($_ _.and
- (_.cover [/.##]
- (let [first_order!
- (let [(open "list#[0]") (list.equivalence n.equivalence)]
- (and (bit#= (# n.equivalence = left right)
- (/.## = left right))
- (list#= (# list.functor each ++ (enum.range n.enum start end))
- (/.## each ++ (enum.range n.enum start end)))))
+ (all _.and
+ (_.cover [/.##]
+ (let [first_order!
+ (let [(open "list#[0]") (list.equivalence n.equivalence)]
+ (and (bit#= (# n.equivalence = left right)
+ (/.## = left right))
+ (list#= (# list.functor each ++ (enum.range n.enum start end))
+ (/.## each ++ (enum.range n.enum start end)))))
- second_order!
- (/.## =
- (enum.range n.enum start end)
- (enum.range n.enum start end))
-
- third_order!
- (let [lln (/.## each (enum.range n.enum start)
- (enum.range n.enum start end))]
- (/.## = lln lln))]
- (and first_order!
second_order!
- third_order!)))
- (_.cover [/.with]
- (/.with [n.addition]
- (n.= (# n.addition composite left right)
- (/.## composite left right))))
- (_.cover [/.implicit:]
- (n.= (# n.multiplication composite left right)
- (/.## composite left right)))
- ))))
+ (/.## =
+ (enum.range n.enum start end)
+ (enum.range n.enum start end))
+
+ third_order!
+ (let [lln (/.## each (enum.range n.enum start)
+ (enum.range n.enum start end))]
+ (/.## = lln lln))]
+ (and first_order!
+ second_order!
+ third_order!)))
+ (_.cover [/.with]
+ (/.with [n.addition]
+ (n.= (# n.addition composite left right)
+ (/.## composite left right))))
+ (_.cover [/.implicit:]
+ (n.= (# n.multiplication composite left right)
+ (/.## composite left right)))
+ ))))
diff --git a/stdlib/source/test/lux/type/poly.lux b/stdlib/source/test/lux/type/poly.lux
index 5f0229c06..0850116fb 100644
--- a/stdlib/source/test/lux/type/poly.lux
+++ b/stdlib/source/test/lux/type/poly.lux
@@ -1,20 +1,20 @@
(.using
- [library
- [lux "*"
- ["_" test {"+" Test}]]]
- [\\library
- ["[0]" /]]
- ["[0]" / "_"
- ["[1][0]" equivalence]
- ["[1][0]" functor]
- ["[1][0]" json]])
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]]]
+ [\\library
+ ["[0]" /]]
+ ["[0]" / "_"
+ ["[1][0]" equivalence]
+ ["[1][0]" functor]
+ ["[1][0]" json]])
(def: .public test
Test
(<| (_.covering /._)
(_.for [/.poly: /.code])
- ($_ _.and
- /equivalence.test
- /functor.test
- /json.test
- )))
+ (all _.and
+ /equivalence.test
+ /functor.test
+ /json.test
+ )))
diff --git a/stdlib/source/test/lux/type/poly/equivalence.lux b/stdlib/source/test/lux/type/poly/equivalence.lux
index 02c94b58e..410627c53 100644
--- a/stdlib/source/test/lux/type/poly/equivalence.lux
+++ b/stdlib/source/test/lux/type/poly/equivalence.lux
@@ -59,22 +59,22 @@
(do [! random.monad]
[size (# ! each (n.% 2) random.nat)
.let [gen_int (|> random.int (# ! each (|>> i.abs (i.% +1,000,000))))]]
- ($_ random.and
- random.bit
- gen_int
- random.safe_frac
- (random.unicode size)
- (random.maybe gen_int)
- (random.list size gen_int)
- ($_ random.or
- random.bit
- gen_int
- random.safe_frac)
- ($_ random.and
- gen_int
- random.safe_frac
- (random.unicode size))
- gen_recursive)))
+ (all random.and
+ random.bit
+ gen_int
+ random.safe_frac
+ (random.unicode size)
+ (random.maybe gen_int)
+ (random.list size gen_int)
+ (all random.or
+ random.bit
+ gen_int
+ random.safe_frac)
+ (all random.and
+ gen_int
+ random.safe_frac
+ (random.unicode size))
+ gen_recursive)))
(for @.old (these)
(these (def: equivalence
diff --git a/stdlib/source/test/lux/type/poly/json.lux b/stdlib/source/test/lux/type/poly/json.lux
index 38b36eecf..00eec73fa 100644
--- a/stdlib/source/test/lux/type/poly/json.lux
+++ b/stdlib/source/test/lux/type/poly/json.lux
@@ -91,21 +91,21 @@
(Random Record)
(do [! random.monad]
[size (# ! each (n.% 2) random.nat)]
- ($_ random.and
- random.bit
- random.safe_frac
- (random.unicode size)
- (random.maybe random.safe_frac)
- (random.list size random.safe_frac)
- (random.dictionary text.hash size (random.unicode size) random.safe_frac)
- ($_ random.or random.bit (random.unicode size) random.safe_frac)
- ($_ random.and random.bit (random.unicode size) random.safe_frac)
- ..gen_recursive
- ... _instant.instant
- ... _duration.duration
- random.date
- ..qty
- )))
+ (all random.and
+ random.bit
+ random.safe_frac
+ (random.unicode size)
+ (random.maybe random.safe_frac)
+ (random.list size random.safe_frac)
+ (random.dictionary text.hash size (random.unicode size) random.safe_frac)
+ (all random.or random.bit (random.unicode size) random.safe_frac)
+ (all random.and random.bit (random.unicode size) random.safe_frac)
+ ..gen_recursive
+ ... _instant.instant
+ ... _duration.duration
+ random.date
+ ..qty
+ )))
(for @.old (these)
(these (def: equivalence
diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux
index cb0f8bffe..44258d4bd 100644
--- a/stdlib/source/test/lux/type/quotient.lux
+++ b/stdlib/source/test/lux/type/quotient.lux
@@ -34,27 +34,27 @@
.let [class (is (-> Nat Text)
(|>> (n.% modulus) %.nat))]
value random.nat]
- ($_ _.and
- (_.for [/.equivalence]
- ($equivalence.spec (/.equivalence text.equivalence)
- (..random (/.class class) random.nat)))
+ (all _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec (/.equivalence text.equivalence)
+ (..random (/.class class) random.nat)))
- (_.for [/.Class]
- (_.cover [/.class]
- (same? (is Any class)
- (is Any (/.class class)))))
- (_.for [/.Quotient]
- ($_ _.and
- (_.cover [/.quotient /.value /.label]
- (let [quotient (/.quotient (/.class class) value)]
- (and (same? value
- (/.value quotient))
- (text#= (class value)
- (/.label quotient)))))
- (_.cover [/.type]
- (exec
- (is ..Mod_10
- (/.quotient ..mod_10_class value))
- true))
- ))
- ))))
+ (_.for [/.Class]
+ (_.cover [/.class]
+ (same? (is Any class)
+ (is Any (/.class class)))))
+ (_.for [/.Quotient]
+ (all _.and
+ (_.cover [/.quotient /.value /.label]
+ (let [quotient (/.quotient (/.class class) value)]
+ (and (same? value
+ (/.value quotient))
+ (text#= (class value)
+ (/.label quotient)))))
+ (_.cover [/.type]
+ (exec
+ (is ..Mod_10
+ (/.quotient ..mod_10_class value))
+ true))
+ ))
+ ))))
diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux
index 2d269d300..d6d5bf660 100644
--- a/stdlib/source/test/lux/type/refinement.lux
+++ b/stdlib/source/test/lux/type/refinement.lux
@@ -34,57 +34,57 @@
(|>> (n.% modulus) (n.= 0)))]
total_raws (# ! each (|>> (n.% 20) ++) random.nat)
raws (random.list total_raws random.nat)]
- ($_ _.and
- (_.for [/.Refiner]
- ($_ _.and
- (_.cover [/.refiner]
- (case (/.refiner predicate raw)
- {.#Some refined}
- (predicate raw)
-
- {.#None}
- (not (predicate raw))))
- (_.cover [/.predicate]
- (|> (/.refiner predicate modulus)
- (maybe#each (|>> /.predicate (same? predicate)))
- (maybe.else false)))
- ))
- (_.cover [/.value]
- (|> (/.refiner predicate modulus)
- (maybe#each (|>> /.value (n.= modulus)))
- (maybe.else false)))
- (_.cover [/.lifted]
- (and (|> (/.refiner predicate modulus)
- (maybe#each (/.lifted (n.+ modulus)))
- maybe#conjoint
- (maybe#each (|>> /.value (n.= (n.+ modulus modulus))))
- (maybe.else false))
- (|> (/.refiner predicate modulus)
- (maybe#each (/.lifted (n.+ (++ modulus))))
- maybe#conjoint
- (maybe#each (|>> /.value (n.= (n.+ modulus (++ modulus)))))
- (maybe.else false)
- not)))
- (_.cover [/.only]
- (let [expected (list.only predicate raws)
- actual (/.only (/.refiner predicate) raws)]
- (and (n.= (list.size expected)
- (list.size actual))
- (# (list.equivalence n.equivalence) =
- expected
- (list#each /.value actual)))))
- (_.cover [/.partition]
- (let [expected (list.only predicate raws)
- [actual alternative] (/.partition (/.refiner predicate) raws)]
- (and (n.= (list.size expected)
- (list.size actual))
- (n.= (n.- (list.size expected) total_raws)
- (list.size alternative))
- (# (list.equivalence n.equivalence) =
- expected
- (list#each /.value actual)))))
- (_.cover [/.type]
- (exec (is (Maybe .._type)
- (.._refiner raw))
- true))
- ))))
+ (all _.and
+ (_.for [/.Refiner]
+ (all _.and
+ (_.cover [/.refiner]
+ (case (/.refiner predicate raw)
+ {.#Some refined}
+ (predicate raw)
+
+ {.#None}
+ (not (predicate raw))))
+ (_.cover [/.predicate]
+ (|> (/.refiner predicate modulus)
+ (maybe#each (|>> /.predicate (same? predicate)))
+ (maybe.else false)))
+ ))
+ (_.cover [/.value]
+ (|> (/.refiner predicate modulus)
+ (maybe#each (|>> /.value (n.= modulus)))
+ (maybe.else false)))
+ (_.cover [/.lifted]
+ (and (|> (/.refiner predicate modulus)
+ (maybe#each (/.lifted (n.+ modulus)))
+ maybe#conjoint
+ (maybe#each (|>> /.value (n.= (n.+ modulus modulus))))
+ (maybe.else false))
+ (|> (/.refiner predicate modulus)
+ (maybe#each (/.lifted (n.+ (++ modulus))))
+ maybe#conjoint
+ (maybe#each (|>> /.value (n.= (n.+ modulus (++ modulus)))))
+ (maybe.else false)
+ not)))
+ (_.cover [/.only]
+ (let [expected (list.only predicate raws)
+ actual (/.only (/.refiner predicate) raws)]
+ (and (n.= (list.size expected)
+ (list.size actual))
+ (# (list.equivalence n.equivalence) =
+ expected
+ (list#each /.value actual)))))
+ (_.cover [/.partition]
+ (let [expected (list.only predicate raws)
+ [actual alternative] (/.partition (/.refiner predicate) raws)]
+ (and (n.= (list.size expected)
+ (list.size actual))
+ (n.= (n.- (list.size expected) total_raws)
+ (list.size alternative))
+ (# (list.equivalence n.equivalence) =
+ expected
+ (list#each /.value actual)))))
+ (_.cover [/.type]
+ (exec (is (Maybe .._type)
+ (.._refiner raw))
+ true))
+ ))))
diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux
index 2c6b1eb29..69709555a 100644
--- a/stdlib/source/test/lux/type/resource.lux
+++ b/stdlib/source/test/lux/type/resource.lux
@@ -33,40 +33,40 @@
post (# ! each %.nat random.nat)
.let [! identity.monad]]
(_.for [/.Linear /.run! /.monad]
- (`` ($_ _.and
- (~~ (template [<coverage> <bindings>]
- [(_.cover <coverage>
- (<| (text#= (format pre post))
- (is (Identity Text))
- (/.run! !)
- (do (/.monad !)
- <bindings>
- (in (format left right)))))]
-
- [[/.Affine /.Key /.Res /.Ordered /.ordered
- /.Relevant /.read]
- [res|left (/.ordered ! pre)
- res|right (/.ordered ! post)
- right (/.read ! res|right)
- left (/.read ! res|left)]]
- [[/.Commutative /.commutative /.exchange]
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.exchange [1 0]) !)
- left (/.read ! res|left)
- right (/.read ! res|right)]]
- [[/.group /.un_group]
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.group 2) !)
- _ ((/.un_group 2) !)
- right (/.read ! res|right)
- left (/.read ! res|left)]]
- [[/.lifted]
- [left (/.lifted ! pre)
- right (/.lifted ! post)]]
- ))
- )))))
+ (`` (all _.and
+ (~~ (template [<coverage> <bindings>]
+ [(_.cover <coverage>
+ (<| (text#= (format pre post))
+ (is (Identity Text))
+ (/.run! !)
+ (do (/.monad !)
+ <bindings>
+ (in (format left right)))))]
+
+ [[/.Affine /.Key /.Res /.Ordered /.ordered
+ /.Relevant /.read]
+ [res|left (/.ordered ! pre)
+ res|right (/.ordered ! post)
+ right (/.read ! res|right)
+ left (/.read ! res|left)]]
+ [[/.Commutative /.commutative /.exchange]
+ [res|left (/.commutative ! pre)
+ res|right (/.commutative ! post)
+ _ ((/.exchange [1 0]) !)
+ left (/.read ! res|left)
+ right (/.read ! res|right)]]
+ [[/.group /.un_group]
+ [res|left (/.commutative ! pre)
+ res|right (/.commutative ! post)
+ _ ((/.group 2) !)
+ _ ((/.un_group 2) !)
+ right (/.read ! res|right)
+ left (/.read ! res|left)]]
+ [[/.lifted]
+ [left (/.lifted ! pre)
+ right (/.lifted ! post)]]
+ ))
+ )))))
(def: sync
Test
@@ -75,41 +75,41 @@
post (# ! each %.nat random.nat)
.let [! io.monad]]
(_.for [/.Linear /.run! /.monad]
- (`` ($_ _.and
- (~~ (template [<coverage> <bindings>]
- [(_.cover <coverage>
- (<| (text#= (format pre post))
- io.run!
- (is (IO Text))
- (/.run! !)
- (do (/.monad !)
- <bindings>
- (in (format left right)))))]
+ (`` (all _.and
+ (~~ (template [<coverage> <bindings>]
+ [(_.cover <coverage>
+ (<| (text#= (format pre post))
+ io.run!
+ (is (IO Text))
+ (/.run! !)
+ (do (/.monad !)
+ <bindings>
+ (in (format left right)))))]
- [[/.Affine /.Key /.Res /.Ordered /.ordered
- /.Relevant /.read]
- [res|left (/.ordered ! pre)
- res|right (/.ordered ! post)
- right (/.read ! res|right)
- left (/.read ! res|left)]]
- [[/.Commutative /.commutative /.exchange]
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.exchange [1 0]) !)
- left (/.read ! res|left)
- right (/.read ! res|right)]]
- [[/.group /.un_group]
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.group 2) !)
- _ ((/.un_group 2) !)
- right (/.read ! res|right)
- left (/.read ! res|left)]]
- [[/.lifted]
- [left (/.lifted ! (io.io pre))
- right (/.lifted ! (io.io post))]]
- ))
- )))))
+ [[/.Affine /.Key /.Res /.Ordered /.ordered
+ /.Relevant /.read]
+ [res|left (/.ordered ! pre)
+ res|right (/.ordered ! post)
+ right (/.read ! res|right)
+ left (/.read ! res|left)]]
+ [[/.Commutative /.commutative /.exchange]
+ [res|left (/.commutative ! pre)
+ res|right (/.commutative ! post)
+ _ ((/.exchange [1 0]) !)
+ left (/.read ! res|left)
+ right (/.read ! res|right)]]
+ [[/.group /.un_group]
+ [res|left (/.commutative ! pre)
+ res|right (/.commutative ! post)
+ _ ((/.group 2) !)
+ _ ((/.un_group 2) !)
+ right (/.read ! res|right)
+ left (/.read ! res|left)]]
+ [[/.lifted]
+ [left (/.lifted ! (io.io pre))
+ right (/.lifted ! (io.io post))]]
+ ))
+ )))))
(def: async
Test
@@ -118,42 +118,42 @@
post (# ! each %.nat random.nat)
.let [! async.monad]]
(_.for [/.Linear /.run! /.monad]
- (`` ($_ _.and
- (~~ (template [<coverage> <bindings>]
- [(in (monad.do !
- [outcome (<| (is (Async Text))
- (/.run! !)
- (do (/.monad !)
- <bindings>
- (in (format left right))))]
- (_.cover' <coverage>
- (text#= (format pre post)
- outcome))))]
+ (`` (all _.and
+ (~~ (template [<coverage> <bindings>]
+ [(in (monad.do !
+ [outcome (<| (is (Async Text))
+ (/.run! !)
+ (do (/.monad !)
+ <bindings>
+ (in (format left right))))]
+ (_.cover' <coverage>
+ (text#= (format pre post)
+ outcome))))]
- [[/.Affine /.Key /.Res /.Ordered /.ordered
- /.Relevant /.read]
- [res|left (/.ordered ! pre)
- res|right (/.ordered ! post)
- right (/.read ! res|right)
- left (/.read ! res|left)]]
- [[/.Commutative /.commutative /.exchange]
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.exchange [1 0]) !)
- left (/.read ! res|left)
- right (/.read ! res|right)]]
- [[/.group /.un_group]
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.group 2) !)
- _ ((/.un_group 2) !)
- right (/.read ! res|right)
- left (/.read ! res|left)]]
- [[/.lifted]
- [left (/.lifted ! (async.resolved pre))
- right (/.lifted ! (async.resolved post))]]
- ))
- )))))
+ [[/.Affine /.Key /.Res /.Ordered /.ordered
+ /.Relevant /.read]
+ [res|left (/.ordered ! pre)
+ res|right (/.ordered ! post)
+ right (/.read ! res|right)
+ left (/.read ! res|left)]]
+ [[/.Commutative /.commutative /.exchange]
+ [res|left (/.commutative ! pre)
+ res|right (/.commutative ! post)
+ _ ((/.exchange [1 0]) !)
+ left (/.read ! res|left)
+ right (/.read ! res|right)]]
+ [[/.group /.un_group]
+ [res|left (/.commutative ! pre)
+ res|right (/.commutative ! post)
+ _ ((/.group 2) !)
+ _ ((/.un_group 2) !)
+ right (/.read ! res|right)
+ left (/.read ! res|left)]]
+ [[/.lifted]
+ [left (/.lifted ! (async.resolved pre))
+ right (/.lifted ! (async.resolved post))]]
+ ))
+ )))))
(syntax: (with_error [exception <code>.symbol
to_expand <code>.any])
@@ -172,20 +172,20 @@
Test
(<| (_.covering /._)
(_.for [/.Procedure])
- ($_ _.and
- ..pure
- ..sync
- ..async
+ (all _.and
+ ..pure
+ ..sync
+ ..async
- (_.cover [/.amount_cannot_be_zero]
- (`` (and (~~ (template [<group|un_group>]
- [(with_error /.amount_cannot_be_zero
- (<group|un_group> 0))]
+ (_.cover [/.amount_cannot_be_zero]
+ (`` (and (~~ (template [<group|un_group>]
+ [(with_error /.amount_cannot_be_zero
+ (<group|un_group> 0))]
- [/.group]
- [/.un_group]
- )))))
- (_.cover [/.index_cannot_be_repeated]
- (with_error /.index_cannot_be_repeated
- (/.exchange [0 0])))
- )))
+ [/.group]
+ [/.un_group]
+ )))))
+ (_.cover [/.index_cannot_be_repeated]
+ (with_error /.index_cannot_be_repeated
+ (/.exchange [0 0])))
+ )))
diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux
index bfcef3bc6..dac454fee 100644
--- a/stdlib/source/test/lux/type/unit.lux
+++ b/stdlib/source/test/lux/type/unit.lux
@@ -36,14 +36,14 @@
(def: polymorphism
Test
- ($_ _.and
- (_.for [/.equivalence]
- ($equivalence.spec /.equivalence (..meter 1,000)))
- (_.for [/.order]
- ($order.spec /.order (..meter 1,000)))
- (_.for [/.enum]
- ($enum.spec /.enum (..meter 1,000)))
- ))
+ (all _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence (..meter 1,000)))
+ (_.for [/.order]
+ ($order.spec /.order (..meter 1,000)))
+ (_.for [/.enum]
+ ($enum.spec /.enum (..meter 1,000)))
+ ))
(/.unit: What what)
@@ -52,30 +52,30 @@
(do random.monad
[expected random.int]
(_.for [/.Unit]
- (`` ($_ _.and
- (~~ (template [<type> <unit>]
- [(_.cover [<type> <unit>]
- (|> expected
- (# <unit> in)
- (# <unit> out)
- (i.= expected)))]
+ (`` (all _.and
+ (~~ (template [<type> <unit>]
+ [(_.cover [<type> <unit>]
+ (|> expected
+ (# <unit> in)
+ (# <unit> out)
+ (i.= expected)))]
- [/.Gram /.gram]
- [/.Meter /.meter]
- [/.Litre /.litre]
- [/.Second /.second]
- ))
- (_.cover [/.Pure /.pure /.number]
- (|> expected
- /.pure
- /.number
- (i.= expected)))
- (_.cover [/.unit:]
- (|> expected
- (# ..what in)
- (# ..what out)
- (i.= expected)))
- )))))
+ [/.Gram /.gram]
+ [/.Meter /.meter]
+ [/.Litre /.litre]
+ [/.Second /.second]
+ ))
+ (_.cover [/.Pure /.pure /.number]
+ (|> expected
+ /.pure
+ /.number
+ (i.= expected)))
+ (_.cover [/.unit:]
+ (|> expected
+ (# ..what in)
+ (# ..what out)
+ (i.= expected)))
+ )))))
(syntax: (natural [])
(# meta.monad each
@@ -108,49 +108,49 @@
(# ! each (i.* (.int how::to)))
(# ! each (# /.meter in)))]
(_.for [/.Scale]
- (`` ($_ _.and
- (~~ (template [<type> <scale>]
- [(_.cover [<type> <scale>]
- (|> large
- (# <scale> scale)
- (is (/.Qty (<type> /.Meter)))
- (# <scale> de_scale)
- (is (/.Qty /.Meter))
- (meter#= large)))]
+ (`` (all _.and
+ (~~ (template [<type> <scale>]
+ [(_.cover [<type> <scale>]
+ (|> large
+ (# <scale> scale)
+ (is (/.Qty (<type> /.Meter)))
+ (# <scale> de_scale)
+ (is (/.Qty /.Meter))
+ (meter#= large)))]
- [/.Kilo /.kilo]
- [/.Mega /.mega]
- [/.Giga /.giga]
- ))
- (~~ (template [<type> <scale>]
- [(_.cover [<type> <scale>]
- (|> small
- (# <scale> scale)
- (is (/.Qty (<type> /.Meter)))
- (# <scale> de_scale)
- (is (/.Qty /.Meter))
- (meter#= small)))]
+ [/.Kilo /.kilo]
+ [/.Mega /.mega]
+ [/.Giga /.giga]
+ ))
+ (~~ (template [<type> <scale>]
+ [(_.cover [<type> <scale>]
+ (|> small
+ (# <scale> scale)
+ (is (/.Qty (<type> /.Meter)))
+ (# <scale> de_scale)
+ (is (/.Qty /.Meter))
+ (meter#= small)))]
- [/.Milli /.milli]
- [/.Micro /.micro]
- [/.Nano /.nano]
- ))
- (_.cover [/.re_scaled]
- (|> large (is (/.Qty /.Meter))
- (# /.kilo scale) (is (/.Qty (/.Kilo /.Meter)))
- (/.re_scaled /.kilo /.milli) (is (/.Qty (/.Milli /.Meter)))
- (/.re_scaled /.milli /.kilo) (is (/.Qty (/.Kilo /.Meter)))
- (# /.kilo de_scale) (is (/.Qty /.Meter))
- (meter#= large)))
- (_.cover [/.scale:]
- (and (|> unscaled
- (# ..how scale)
- (# ..how de_scale)
- (meter#= unscaled))
- (ratio#= [..how::from
- ..how::to]
- (# ..how ratio))))
- )))))
+ [/.Milli /.milli]
+ [/.Micro /.micro]
+ [/.Nano /.nano]
+ ))
+ (_.cover [/.re_scaled]
+ (|> large (is (/.Qty /.Meter))
+ (# /.kilo scale) (is (/.Qty (/.Kilo /.Meter)))
+ (/.re_scaled /.kilo /.milli) (is (/.Qty (/.Milli /.Meter)))
+ (/.re_scaled /.milli /.kilo) (is (/.Qty (/.Kilo /.Meter)))
+ (# /.kilo de_scale) (is (/.Qty /.Meter))
+ (meter#= large)))
+ (_.cover [/.scale:]
+ (and (|> unscaled
+ (# ..how scale)
+ (# ..how de_scale)
+ (meter#= unscaled))
+ (ratio#= [..how::from
+ ..how::to]
+ (# ..how ratio))))
+ )))))
(def: arithmetic
Test
@@ -161,34 +161,34 @@
left (random.only (|>> (meter#= zero) not) (..meter 1,000))
right (..meter 1,000)
extra (..second 1,000)]
- (`` ($_ _.and
- (~~ (template [<q> <i>]
- [(_.cover [<q>]
- (i.= (<i> (# /.meter out left) (# /.meter out right))
- (# /.meter out (<q> left right))))]
+ (`` (all _.and
+ (~~ (template [<q> <i>]
+ [(_.cover [<q>]
+ (i.= (<i> (# /.meter out left) (# /.meter out right))
+ (# /.meter out (<q> left right))))]
- [/.+ i.+]
- [/.- i.-]
- ))
- (_.cover [/.*]
- (let [expected (i.* (# /.meter out left) (# /.meter out right))
- actual ((debug.private /.out') (is (/.Qty [/.Meter /.Meter])
- (/.* left right)))]
- (i.= expected actual)))
- (_.cover [/./]
- (|> right
- (/.* left)
- (/./ left)
- (meter#= right)))
- ))))
+ [/.+ i.+]
+ [/.- i.-]
+ ))
+ (_.cover [/.*]
+ (let [expected (i.* (# /.meter out left) (# /.meter out right))
+ actual ((debug.private /.out') (is (/.Qty [/.Meter /.Meter])
+ (/.* left right)))]
+ (i.= expected actual)))
+ (_.cover [/./]
+ (|> right
+ (/.* left)
+ (/./ left)
+ (meter#= right)))
+ ))))
(def: .public test
Test
(<| (_.covering /._)
(_.for [/.Qty])
- ($_ _.and
- ..polymorphism
- ..unit
- ..scale
- ..arithmetic
- )))
+ (all _.and
+ ..polymorphism
+ ..unit
+ ..scale
+ ..arithmetic
+ )))
diff --git a/stdlib/source/test/lux/type/variance.lux b/stdlib/source/test/lux/type/variance.lux
index f4442550e..5f4cbe862 100644
--- a/stdlib/source/test/lux/type/variance.lux
+++ b/stdlib/source/test/lux/type/variance.lux
@@ -1,15 +1,15 @@
(.using
- [library
- [lux "*"
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]]
- [math
- ["[0]" random {"+" Random}]]]]
- [\\library
- ["[0]" /
- ["/[1]" // "_"
- ["[1][0]" check]]]])
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]]
+ [math
+ ["[0]" random {"+" Random}]]]]
+ [\\library
+ ["[0]" /
+ ["/[1]" // "_"
+ ["[1][0]" check]]]])
(type: Super
(Ex (_ sub) [Text sub]))
@@ -20,16 +20,16 @@
(def: .public test
Test
(<| (_.covering /._)
- ($_ _.and
- (_.cover [/.Co]
- (and (//check.subsumes? (type (/.Co Super)) (type (/.Co Sub)))
- (not (//check.subsumes? (type (/.Co Sub)) (type (/.Co Super))))))
- (_.cover [/.Contra]
- (and (//check.subsumes? (type (/.Contra Sub)) (type (/.Contra Super)))
- (not (//check.subsumes? (type (/.Contra Super)) (type (/.Contra Sub))))))
- (_.cover [/.In]
- (and (//check.subsumes? (type (/.In Super)) (type (/.In Super)))
- (//check.subsumes? (type (/.In Sub)) (type (/.In Sub)))
- (not (//check.subsumes? (type (/.In Sub)) (type (/.In Super))))
- (not (//check.subsumes? (type (/.In Super)) (type (/.In Sub))))))
- )))
+ (all _.and
+ (_.cover [/.Co]
+ (and (//check.subsumes? (type (/.Co Super)) (type (/.Co Sub)))
+ (not (//check.subsumes? (type (/.Co Sub)) (type (/.Co Super))))))
+ (_.cover [/.Contra]
+ (and (//check.subsumes? (type (/.Contra Sub)) (type (/.Contra Super)))
+ (not (//check.subsumes? (type (/.Contra Super)) (type (/.Contra Sub))))))
+ (_.cover [/.In]
+ (and (//check.subsumes? (type (/.In Super)) (type (/.In Super)))
+ (//check.subsumes? (type (/.In Sub)) (type (/.In Sub)))
+ (not (//check.subsumes? (type (/.In Sub)) (type (/.In Super))))
+ (not (//check.subsumes? (type (/.In Super)) (type (/.In Sub))))))
+ )))