diff options
Diffstat (limited to 'stdlib/source/test/lux/control/pipe.lux')
-rw-r--r-- | stdlib/source/test/lux/control/pipe.lux | 115 |
1 files changed, 58 insertions, 57 deletions
diff --git a/stdlib/source/test/lux/control/pipe.lux b/stdlib/source/test/lux/control/pipe.lux index 0e8acc13f..32153db22 100644 --- a/stdlib/source/test/lux/control/pipe.lux +++ b/stdlib/source/test/lux/control/pipe.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" debug] - [abstract - [monad {"+" do}]] - [data - ["[0]" identity] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" debug] + [abstract + [monad {"+" do}]] + [data + ["[0]" identity] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: .public test Test @@ -24,65 +24,65 @@ ($_ _.and (do ! [another random.nat] - (_.cover [/.new>] + (_.cover [/.new] (n.= (++ another) (|> sample (n.* 3) (n.+ 4) - (/.new> another [++]))))) - (_.cover [/.let>] + (/.new another [++]))))) + (_.cover [/.let] (n.= (n.+ sample sample) (|> sample - (/.let> x [(n.+ x x)])))) - (_.cover [/.cond>] + (/.let x [(n.+ x x)])))) + (_.cover [/.cond] (text#= (cond (n.= 0 sample) "zero" (n.even? sample) "even" "odd") (|> sample - (/.cond> [(n.= 0)] [(/.new> "zero" [])] - [n.even?] [(/.new> "even" [])] - [(/.new> "odd" [])])))) - (_.cover [/.if>] + (/.cond [(n.= 0)] [(/.new "zero" [])] + [n.even?] [(/.new "even" [])] + [(/.new "odd" [])])))) + (_.cover [/.if] (text#= (if (n.even? sample) "even" "odd") (|> sample - (/.if> [n.even?] - [(/.new> "even" [])] - [(/.new> "odd" [])])))) - (_.cover [/.when>] + (/.if [n.even?] + [(/.new "even" [])] + [(/.new "odd" [])])))) + (_.cover [/.when] (n.= (if (n.even? sample) (n.* 2 sample) sample) (|> sample - (/.when> [n.even?] - [(n.* 2)])))) - (_.cover [/.loop>] + (/.when [n.even?] + [(n.* 2)])))) + (_.cover [/.loop] (n.= (n.* 10 sample) (|> sample - (/.loop> [(n.= (n.* 10 sample)) not] - [(n.+ sample)])))) - (_.cover [/.do>] + (/.loop [(n.= (n.* 10 sample)) not] + [(n.+ sample)])))) + (_.cover [/.do] (n.= (++ (n.+ 4 (n.* 3 sample))) (|> sample - (/.do> identity.monad - [(n.* 3)] - [(n.+ 4)] - [++])))) - (_.cover [/.exec>] + (/.do identity.monad + [(n.* 3)] + [(n.+ 4)] + [++])))) + (_.cover [/.exec] (n.= (n.* 10 sample) (|> sample - (/.exec> [%.nat (format "sample = ") debug.log!]) + (/.exec [%.nat (format "sample = ") debug.log!]) (n.* 10)))) - (_.cover [/.tuple>] + (_.cover [/.tuple] (let [[left middle right] (|> sample - (/.tuple> [++] - [--] - [%.nat]))] + (/.tuple [++] + [--] + [%.nat]))] (and (n.= (++ sample) left) (n.= (-- sample) middle) (text#= (%.nat sample) right)))) - (_.cover [/.case>] + (_.cover [/.case] (text#= (case (n.% 10 sample) 0 "zero" 1 "one" @@ -97,15 +97,16 @@ _ "???") (|> sample (n.% 10) - (/.case> 0 "zero" - 1 "one" - 2 "two" - 3 "three" - 4 "four" - 5 "five" - 6 "six" - 7 "seven" - 8 "eight" - 9 "nine" - _ "???")))) + (/.case + 0 "zero" + 1 "one" + 2 "two" + 3 "three" + 4 "four" + 5 "five" + 6 "six" + 7 "seven" + 8 "eight" + 9 "nine" + _ "???")))) )))) |