diff options
Diffstat (limited to 'stdlib/source/test/lux/control/function/mixin.lux')
-rw-r--r-- | stdlib/source/test/lux/control/function/mixin.lux | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 7ec7c8c09..9dd982afd 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -30,16 +30,16 @@ [input (|> random.nat (# ! each (|>> (n.% 6) (n.+ 20)))) dummy random.nat shift (|> random.nat (random.only (|>> (n.= dummy) not))) - .let [equivalence (: (Equivalence (/.Mixin Nat Nat)) - (implementation - (def: (= left right) - (n.= ((/.fixed left) input) - ((/.fixed right) input))))) - generator (: (Random (/.Mixin Nat Nat)) - (do ! - [output random.nat] - (in (function (_ delegate again input) - output)))) + .let [equivalence (is (Equivalence (/.Mixin Nat Nat)) + (implementation + (def: (= left right) + (n.= ((/.fixed left) input) + ((/.fixed right) input))))) + generator (is (Random (/.Mixin Nat Nat)) + (do ! + [output random.nat] + (in (function (_ delegate again input) + output)))) expected (|> (list.indices input) (list#each ++) (list#mix n.* 1))]]) @@ -58,23 +58,23 @@ (n.= expected (factorial input)))) (_.cover [/.mixed] - (let [bottom (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (case input - (^.or 0 1) 1 - _ (delegate input)))) - multiplication (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (n.* input (again (-- input))))) + (let [bottom (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (case input + (^.or 0 1) 1 + _ (delegate input)))) + multiplication (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (n.* input (again (-- input))))) factorial (/.fixed (/.mixed bottom multiplication))] (n.= expected (factorial input)))) (_.cover [/.nothing] - (let [loop (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (case input - (^.or 0 1) 1 - _ (n.* input (delegate (-- input)))))) + (let [loop (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (case input + (^.or 0 1) 1 + _ (n.* input (delegate (-- input)))))) left (/.fixed (/.mixed /.nothing loop)) right (/.fixed (/.mixed loop /.nothing))] (and (n.= expected @@ -82,43 +82,43 @@ (n.= expected (right input))))) (_.cover [/.advice] - (let [bottom (: (/.Mixin Nat Nat) - (function (_ delegate again input) - 1)) - bottom? (: (Predicate Nat) - (function (_ input) - (case input - (^.or 0 1) true - _ false))) - multiplication (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (n.* input (again (-- input))))) + (let [bottom (is (/.Mixin Nat Nat) + (function (_ delegate again input) + 1)) + bottom? (is (Predicate Nat) + (function (_ input) + (case input + (^.or 0 1) true + _ false))) + multiplication (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (n.* input (again (-- input))))) factorial (/.fixed (/.mixed (/.advice bottom? bottom) multiplication))] (n.= expected (factorial input)))) (_.cover [/.before] - (let [implant (: (-> Nat (State Nat [])) - (function (_ input) - (function (_ state) - [shift []]))) - meld (: (/.Mixin Nat (State Nat Nat)) - (function (_ delegate again input) - (function (_ state) - [state (n.+ state input)]))) + (let [implant (is (-> Nat (State Nat [])) + (function (_ input) + (function (_ state) + [shift []]))) + meld (is (/.Mixin Nat (State Nat Nat)) + (function (_ delegate again input) + (function (_ state) + [state (n.+ state input)]))) function (/.fixed (/.mixed (/.before state.monad implant) meld))] (n.= (n.+ shift input) (|> input function (state.result dummy) product.right)))) (_.cover [/.after] - (let [implant (: (-> Nat Nat (State Nat [])) - (function (_ input output) - (function (_ state) - [shift []]))) - meld (: (/.Mixin Nat (State Nat Nat)) - (function (_ delegate again input) - (function (_ state) - [state (n.+ state input)]))) + (let [implant (is (-> Nat Nat (State Nat [])) + (function (_ input output) + (function (_ state) + [shift []]))) + meld (is (/.Mixin Nat (State Nat Nat)) + (function (_ delegate again input) + (function (_ state) + [state (n.+ state input)]))) function (/.fixed (/.mixed (/.after state.monad implant) meld))] (n.= (n.+ dummy input) |