aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data')
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux13
-rw-r--r--stdlib/source/test/lux/data/collection/tree/zipper.lux204
-rw-r--r--stdlib/source/test/lux/data/format/xml.lux1
-rw-r--r--stdlib/source/test/lux/data/sum.lux16
-rw-r--r--stdlib/source/test/lux/data/text.lux90
-rw-r--r--stdlib/source/test/lux/data/text/regex.lux80
6 files changed, 206 insertions, 198 deletions
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 458b447e4..e4d2bb2aa 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -14,7 +14,7 @@
["$[0]" apply]
["$[0]" monad]]]
[control
- pipe
+ ["[0]" pipe]
["[0]" io]
["[0]" maybe]
["[0]" function]]
@@ -76,11 +76,12 @@
[a (lifted (io#in parameter))
b (in subject)]
(in (n.+ a b))))
- (case> (^ (list actual))
- (n.= expected actual)
-
- _
- false)))))
+ (pipe.case
+ (^ (list actual))
+ (n.= expected actual)
+
+ _
+ false)))))
))
(def: whole
diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux
index 55d01f81e..111597da6 100644
--- a/stdlib/source/test/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux
@@ -1,29 +1,29 @@
(.using
- [library
- [lux "*"
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]
- [\\specification
- ["$[0]" equivalence]
- ["$[0]" functor]
- ["$[0]" comonad]]]
- [control
- pipe
- ["[0]" maybe ("[1]#[0]" functor)]]
- [data
- ["[0]" product]
- ["[0]" text]
- [collection
- ["[0]" list]]]
- [math
- ["[0]" random]
- [number
- ["n" nat]]]]]
- ["[0]" //]
- [\\library
- ["[0]" / {"+" Zipper}
- ["tree" //]]])
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" functor]
+ ["$[0]" comonad]]]
+ [control
+ ["[0]" pipe]
+ ["[0]" maybe ("[1]#[0]" functor)]]
+ [data
+ ["[0]" product]
+ ["[0]" text]
+ [collection
+ ["[0]" list]]]
+ [math
+ ["[0]" random]
+ [number
+ ["n" nat]]]]]
+ ["[0]" //]
+ [\\library
+ ["[0]" / {"+" Zipper}
+ ["tree" //]]])
(def: move
Test
@@ -34,25 +34,25 @@
(_.cover [/.down]
(|> (tree.branch dummy (list (tree.leaf expected)))
/.zipper
- (do> maybe.monad
- [/.down]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.up]
(|> (tree.branch expected (list (tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.down]
- [/.up]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.up]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.right]
(|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected)))
/.zipper
- (do> maybe.monad
- [/.down]
- [/.right]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.right]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.rightmost]
(|> (tree.branch dummy
@@ -61,19 +61,19 @@
(tree.leaf dummy)
(tree.leaf expected)))
/.zipper
- (do> maybe.monad
- [/.down]
- [/.rightmost]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.rightmost]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.left]
(|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.down]
- [/.right]
- [/.left]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.right]
+ [/.left]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.leftmost]
(|> (tree.branch dummy
@@ -82,29 +82,29 @@
(tree.leaf dummy)
(tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.down]
- [/.rightmost]
- [/.leftmost]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.rightmost]
+ [/.leftmost]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.next]
(and (|> (tree.branch dummy
(list (tree.leaf expected)
(tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.next]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.next]
+ [/.value (n.= expected) in])
(maybe.else false))
(|> (tree.branch dummy
(list (tree.leaf dummy)
(tree.leaf expected)))
/.zipper
- (do> maybe.monad
- [/.next]
- [/.next]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.next]
+ [/.next]
+ [/.value (n.= expected) in])
(maybe.else false))))
(_.cover [/.end]
(|> (tree.branch dummy
@@ -113,9 +113,9 @@
(tree.leaf dummy)
(tree.leaf expected)))
/.zipper
- (do> maybe.monad
- [/.end]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.end]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.start]
(|> (tree.branch expected
@@ -124,30 +124,30 @@
(tree.leaf dummy)
(tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.end]
- [/.start]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.end]
+ [/.start]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.previous]
(and (|> (tree.branch expected
(list (tree.leaf dummy)
(tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.next]
- [/.previous]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.next]
+ [/.previous]
+ [/.value (n.= expected) in])
(maybe.else false))
(|> (tree.branch dummy
(list (tree.leaf expected)
(tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.next]
- [/.next]
- [/.previous]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.next]
+ [/.next]
+ [/.previous]
+ [/.value (n.= expected) in])
(maybe.else false))))
)))
@@ -205,15 +205,15 @@
(/.interpose expected))]
(and (n.= dummy (/.value cursor))
(|> cursor
- (do> maybe.monad
- [/.down]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.value (n.= expected) in])
(maybe.else false))
(|> cursor
- (do> maybe.monad
- [/.down]
- [/.down]
- [/.value (n.= dummy) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.down]
+ [/.value (n.= dummy) in])
(maybe.else false)))))
(_.cover [/.adopt]
(let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
@@ -221,41 +221,41 @@
(/.adopt expected))]
(and (n.= dummy (/.value cursor))
(|> cursor
- (do> maybe.monad
- [/.down]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.value (n.= expected) in])
(maybe.else false))
(|> cursor
- (do> maybe.monad
- [/.down]
- [/.right]
- [/.value (n.= dummy) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [/.right]
+ [/.value (n.= dummy) in])
(maybe.else false)))))
(_.cover [/.insert_left]
(|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.down]
- [(/.insert_left expected)]
- [/.left]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [(/.insert_left expected)]
+ [/.left]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.insert_right]
(|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.down]
- [(/.insert_right expected)]
- [/.right]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [(/.insert_right expected)]
+ [/.right]
+ [/.value (n.= expected) in])
(maybe.else false)))
(_.cover [/.remove]
(|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
- (do> maybe.monad
- [/.down]
- [(/.insert_left expected)]
- [/.remove]
- [/.value (n.= expected) in])
+ (pipe.do maybe.monad
+ [/.down]
+ [(/.insert_left expected)]
+ [/.remove]
+ [/.value (n.= expected) in])
(maybe.else false)))
))))
diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux
index 0ee929ca7..439fe1f5c 100644
--- a/stdlib/source/test/lux/data/format/xml.lux
+++ b/stdlib/source/test/lux/data/format/xml.lux
@@ -8,7 +8,6 @@
["$[0]" equivalence]
["$[0]" codec]]]
[control
- pipe
["[0]" maybe]
["[0]" try]
["p" parser
diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux
index 2aa3c5058..6dc6eeb9e 100644
--- a/stdlib/source/test/lux/data/sum.lux
+++ b/stdlib/source/test/lux/data/sum.lux
@@ -8,7 +8,7 @@
["$[0]" equivalence]
["$[0]" hash]]]
[control
- pipe]
+ ["[0]" pipe]]
[data
["[0]" text]
[collection
@@ -39,13 +39,15 @@
(_.cover [/.left]
(|> (/.left expected)
(: (Or Nat Nat))
- (case> {0 #0 actual} (n.= expected actual)
- _ false)))
+ (pipe.case
+ {0 #0 actual} (n.= expected actual)
+ _ false)))
(_.cover [/.right]
(|> (/.right expected)
(: (Or Nat Nat))
- (case> {0 #1 actual} (n.= expected actual)
- _ false)))
+ (pipe.case
+ {0 #1 actual} (n.= expected actual)
+ _ false)))
(_.cover [/.either]
(and (|> (/.left expected)
(: (Or Nat Nat))
@@ -59,11 +61,11 @@
(and (|> (/.left expected)
(: (Or Nat Nat))
(/.then (n.+ shift) (n.- shift))
- (case> {0 #0 actual} (n.= (n.+ shift expected) actual) _ false))
+ (pipe.case {0 #0 actual} (n.= (n.+ shift expected) actual) _ false))
(|> (/.right expected)
(: (Or Nat Nat))
(/.then (n.+ shift) (n.- shift))
- (case> {0 #1 actual} (n.= (n.- shift expected) actual) _ false))))
+ (pipe.case {0 #1 actual} (n.= (n.- shift expected) actual) _ false))))
(do !
[size (# ! each (n.% 5) random.nat)
expected (random.list size random.nat)]
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index faa8e0f86..ed6cc5d9d 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -1,35 +1,35 @@
(.using
- [library
- [lux {"-" char}
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]
- [\\specification
- ["$[0]" equivalence]
- ["$[0]" hash]
- ["$[0]" order]
- ["$[0]" monoid]]]
- [control
- pipe
- ["[0]" maybe]]
- [data
- [collection
- ["[0]" list]
- ["[0]" set]]]
- [math
- ["[0]" random]
- [number
- ["n" nat]]]]]
- ["[0]" / "_"
- ["[1][0]" buffer]
- ["[1][0]" encoding]
- ["[1][0]" format]
- ["[1][0]" regex]
- ["[1][0]" escape]
- ["[1][0]" unicode "_"
- ["[1]" set]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" char}
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" hash]
+ ["$[0]" order]
+ ["$[0]" monoid]]]
+ [control
+ ["[0]" pipe]
+ ["[0]" maybe]]
+ [data
+ [collection
+ ["[0]" list]
+ ["[0]" set]]]
+ [math
+ ["[0]" random]
+ [number
+ ["n" nat]]]]]
+ ["[0]" / "_"
+ ["[1][0]" buffer]
+ ["[1][0]" encoding]
+ ["[1][0]" format]
+ ["[1][0]" regex]
+ ["[1][0]" escape]
+ ["[1][0]" unicode "_"
+ ["[1]" set]]]
+ [\\library
+ ["[0]" /]])
(def: bounded_size
(random.Random Nat)
@@ -289,26 +289,28 @@
($_ _.and
(_.cover [/.split_at]
(|> (/.split_at sizeL sample)
- (case> {.#Right [_l _r]}
- (and (/#= sampleL _l)
- (/#= sampleR _r)
- (/#= sample (/.together (list _l _r))))
+ (pipe.case
+ {.#Right [_l _r]}
+ (and (/#= sampleL _l)
+ (/#= sampleR _r)
+ (/#= sample (/.together (list _l _r))))
- _
- #0)))
+ _
+ #0)))
(_.cover [/.clip /.clip_since]
(|> [(/.clip 0 sizeL sample)
(/.clip sizeL (n.- sizeL (/.size sample)) sample)
(/.clip_since sizeL sample)
(/.clip_since 0 sample)]
- (case> [{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}]
- (and (/#= sampleL _l)
- (/#= sampleR _r)
- (/#= _r _r')
- (/#= sample _f))
+ (pipe.case
+ [{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}]
+ (and (/#= sampleL _l)
+ (/#= sampleR _r)
+ (/#= _r _r')
+ (/#= sample _f))
- _
- #0)))
+ _
+ #0)))
))
(do [! random.monad]
[sizeP bounded_size
diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux
index d5596ae56..0ab71cbaa 100644
--- a/stdlib/source/test/lux/data/text/regex.lux
+++ b/stdlib/source/test/lux/data/text/regex.lux
@@ -1,56 +1,59 @@
(.using
- [library
- [lux "*"
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]]
- [control
- pipe
- ["[0]" try]
- [parser
- ["<[0]>" text {"+" Parser}]
- ["<[0]>" code]]]
- [data
- ["[0]" text ("[1]#[0]" equivalence)
- ["%" format {"+" format}]]]
- ["[0]" macro
- [syntax {"+" syntax:}]
- ["[0]" code]]
- [math
- [number {"+" hex}]
- ["[0]" random]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" pipe]
+ ["[0]" try]
+ [parser
+ ["<[0]>" text {"+" Parser}]
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text ("[1]#[0]" equivalence)
+ ["%" format {"+" format}]]]
+ ["[0]" macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [math
+ [number {"+" hex}]
+ ["[0]" random]]]]
+ [\\library
+ ["[0]" /]])
(def: (should_pass regex input)
(-> (Parser Text) Text Bit)
(|> input
(<text>.result regex)
- (case> {try.#Success parsed}
- (text#= parsed input)
+ (pipe.case
+ {try.#Success parsed}
+ (text#= parsed input)
- _
- #0)))
+ _
+ #0)))
(def: (text_should_pass test regex input)
(-> Text (Parser Text) Text Bit)
(|> input
(<text>.result regex)
- (case> {try.#Success parsed}
- (text#= test parsed)
+ (pipe.case
+ {try.#Success parsed}
+ (text#= test parsed)
- _
- false)))
+ _
+ false)))
(def: (should_fail regex input)
(All (_ a) (-> (Parser a) Text Bit))
(|> input
(<text>.result regex)
- (case> {try.#Failure _}
- true
+ (pipe.case
+ {try.#Failure _}
+ true
- _
- false)))
+ _
+ false)))
(syntax: (should_check [pattern <code>.any
regex <code>.any
@@ -58,11 +61,12 @@
(macro.with_symbols [g!message g!_]
(in (list (` (|> (~ input)
(<text>.result (~ regex))
- (case> (^ {try.#Success (~ pattern)})
- true
+ (pipe.case
+ (^ {try.#Success (~ pattern)})
+ true
- (~ g!_)
- false)))))))
+ (~ g!_)
+ false)))))))
(def: basics
Test