diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/control/concatenative.lux | 323 |
1 files changed, 161 insertions, 162 deletions
diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 354cc744a..4092dbd0d 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -17,7 +17,7 @@ ["r" rev] ["f" frac]]]]] [\\library - ["[0]" / (.only word: => ||>)]]) + ["[0]" / (.only =>)]]) (def: stack_shuffling Test @@ -27,68 +27,68 @@ (`` (all _.and (_.coverage [/.push] (n.= sample - (||> (/.push sample)))) + (/.value (/.push sample)))) (_.coverage [/.drop] (n.= sample - (||> (/.push sample) - (/.push dummy) - /.drop))) + (/.value (|>> (/.push sample) + (/.push dummy) + /.drop)))) (_.coverage [/.nip] (n.= sample - (||> (/.push dummy) - (/.push sample) - /.nip))) + (/.value (|>> (/.push dummy) + (/.push sample) + /.nip)))) (_.coverage [/.dup] - (||> (/.push sample) - /.dup - /.n/=)) + (/.value (|>> (/.push sample) + /.dup + /.n/=))) (_.coverage [/.swap] (n.= sample - (||> (/.push sample) - (/.push dummy) - /.swap))) - (_.coverage [/.rotL] + (/.value (|>> (/.push sample) + (/.push dummy) + /.swap)))) + (_.coverage [/.left_rotation] (n.= sample - (||> (/.push sample) - (/.push dummy) - (/.push dummy) - /.rotL))) - (_.coverage [/.rotR] + (/.value (|>> (/.push sample) + (/.push dummy) + (/.push dummy) + /.left_rotation)))) + (_.coverage [/.right_rotation] (n.= sample - (||> (/.push dummy) - (/.push sample) - (/.push dummy) - /.rotR))) + (/.value (|>> (/.push dummy) + (/.push sample) + (/.push dummy) + /.right_rotation)))) (_.coverage [/.&&] - (let [[left right] (||> (/.push sample) - (/.push dummy) - /.&&)] + (let [[left right] (/.value (|>> (/.push sample) + (/.push dummy) + /.&&))] (and (n.= sample left) (n.= dummy right)))) (~~ (with_template [<function> <tag>] [(_.coverage [<function>] ((sum.equivalence n.= n.=) {<tag> sample} - (||> (/.push sample) - <function>)))] + (/.value (|>> (/.push sample) + <function>))))] - [/.||L .#Left] - [/.||R .#Right])) + [/.left .#Left] + [/.right .#Right])) (_.coverage [/.dip] (n.= (++ sample) - (||> (/.push sample) - (/.push dummy) - (/.push (/.apply_1 ++)) - /.dip - /.drop))) + (/.value (|>> (/.push sample) + (/.push dummy) + (/.push (/.apply_1 ++)) + /.dip + /.drop)))) (_.coverage [/.dip_2] (n.= (++ sample) - (||> (/.push sample) - (/.push dummy) - (/.push dummy) - (/.push (/.apply_1 ++)) - /.dip_2 - /.drop /.drop))) + (/.value (|>> (/.push sample) + (/.push dummy) + (/.push dummy) + (/.push (/.apply_1 ++)) + /.dip_2 + /.drop /.drop)))) )))) (def: !numerical @@ -103,17 +103,17 @@ (~~ (with_template [<concatenative> <functional>] [(_.coverage [<concatenative>] (<=> (<functional> parameter subject) - (||> (/.push subject) - (/.push parameter) - <concatenative>)))] + (/.value (|>> (/.push subject) + (/.push parameter) + <concatenative>))))] <arithmetic>')) (~~ (with_template [<concatenative> <functional>] [(_.coverage [<concatenative>] (bit#= (<functional> parameter subject) - (||> (/.push subject) - (/.push parameter) - <concatenative>)))] + (/.value (|>> (/.push subject) + (/.push parameter) + <concatenative>))))] <order>')) )))))])) @@ -149,167 +149,166 @@ (all _.and (_.coverage [/.call /.apply_1] (n.= (++ sample) - (||> (/.push sample) - (/.push (/.apply_1 ++)) - /.call))) + (/.value (|>> (/.push sample) + (/.push (/.apply_1 ++)) + /.call)))) (_.coverage [/.apply_2] (n.= (n.+ sample sample) - (||> (/.push sample) - (/.push sample) - (/.push (/.apply_2 n.+)) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push (/.apply_2 n.+)) + /.call)))) (_.coverage [/.apply_3] (n.= (all n.+ sample sample sample) - (||> (/.push sample) - (/.push sample) - (/.push sample) - (/.push (/.apply_3 (function (_ i0 i1 i2) - (all n.+ i0 i1 i2)))) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push sample) + (/.push (/.apply_3 (function (_ i0 i1 i2) + (all n.+ i0 i1 i2)))) + /.call)))) (_.coverage [/.apply_4] (n.= (all n.+ sample sample sample sample) - (||> (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push (/.apply_4 (function (_ i0 i1 i2 i3) - (all n.+ i0 i1 i2 i3)))) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push (/.apply_4 (function (_ i0 i1 i2 i3) + (all n.+ i0 i1 i2 i3)))) + /.call)))) (_.coverage [/.apply_5] (n.= (all n.+ sample sample sample sample sample) - (||> (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push (/.apply_5 (function (_ i0 i1 i2 i3 i4) - (all n.+ i0 i1 i2 i3 i4)))) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push (/.apply_5 (function (_ i0 i1 i2 i3 i4) + (all n.+ i0 i1 i2 i3 i4)))) + /.call)))) (_.coverage [/.apply_6] (n.= (all n.+ sample sample sample sample sample sample) - (||> (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push (/.apply_6 (function (_ i0 i1 i2 i3 i4 i5) - (all n.+ i0 i1 i2 i3 i4 i5)))) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push (/.apply_6 (function (_ i0 i1 i2 i3 i4 i5) + (all n.+ i0 i1 i2 i3 i4 i5)))) + /.call)))) (_.coverage [/.apply_7] (n.= (all n.+ sample sample sample sample sample sample sample) - (||> (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push (/.apply_7 (function (_ i0 i1 i2 i3 i4 i5 i6) - (all n.+ i0 i1 i2 i3 i4 i5 i6)))) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push (/.apply_7 (function (_ i0 i1 i2 i3 i4 i5 i6) + (all n.+ i0 i1 i2 i3 i4 i5 i6)))) + /.call)))) (_.coverage [/.apply_8] (n.= (all n.+ sample sample sample sample sample sample sample sample) - (||> (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push (/.apply_8 (function (_ i0 i1 i2 i3 i4 i5 i6 i7) - (all n.+ i0 i1 i2 i3 i4 i5 i6 i7)))) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push (/.apply_8 (function (_ i0 i1 i2 i3 i4 i5 i6 i7) + (all n.+ i0 i1 i2 i3 i4 i5 i6 i7)))) + /.call)))) (_.coverage [/.apply] (n.= (all n.+ sample sample sample sample sample sample sample sample sample) - (||> (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push sample) - (/.push ((/.apply 9) (function (_ i0 i1 i2 i3 i4 i5 i6 i7 i8) - (all n.+ i0 i1 i2 i3 i4 i5 i6 i7 i8)))) - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push sample) + (/.push ((/.apply 9) (function (_ i0 i1 i2 i3 i4 i5 i6 i7 i8) + (all n.+ i0 i1 i2 i3 i4 i5 i6 i7 i8)))) + /.call)))) (_.coverage [/.if] (n.= (if choice (++ sample) (-- sample)) - (||> (/.push sample) - (/.push choice) - (/.push (/.apply_1 ++)) - (/.push (/.apply_1 --)) - /.if))) + (/.value (|>> (/.push sample) + (/.push choice) + (/.push (/.apply_1 ++)) + (/.push (/.apply_1 --)) + /.if)))) (_.coverage [/.loop] (n.= (n.+ distance start) - (||> (/.push start) - (/.push (is (/.=> [Nat] [Nat Bit]) - (|>> |++| /.dup |test|))) - /.loop))) + (/.value (|>> (/.push start) + (/.push (is (/.=> [Nat] [Nat Bit]) + (|>> |++| /.dup |test|))) + /.loop)))) (_.coverage [/.while] (n.= (n.+ distance start) - (||> (/.push start) - (/.push (is (/.=> [Nat] [Nat Bit]) - (|>> /.dup |test|))) - (/.push |++|) - /.while))) + (/.value (|>> (/.push start) + (/.push (is (/.=> [Nat] [Nat Bit]) + (|>> /.dup |test|))) + (/.push |++|) + /.while)))) (_.coverage [/.do] (n.= (++ sample) - (||> (/.push sample) - (/.push (is (/.=> [] [Bit]) - (|>> (/.push false)))) - (/.push |++|) - /.do /.while))) + (/.value (|>> (/.push sample) + (/.push (is (/.=> [] [Bit]) + (|>> (/.push false)))) + (/.push |++|) + /.do /.while)))) (_.coverage [/.compose] (n.= (++ (++ sample)) - (||> (/.push sample) - (/.push |++|) - (/.push |++|) - /.compose - /.call))) + (/.value (|>> (/.push sample) + (/.push |++|) + (/.push |++|) + /.compose + /.call)))) (_.coverage [/.partial] (n.= (n.+ sample sample) - (||> (/.push sample) - (/.push sample) - (/.push (/.apply_2 n.+)) - /.partial - /.call))) + (/.value (|>> (/.push sample) + (/.push sample) + (/.push (/.apply_2 n.+)) + /.partial + /.call)))) (_.coverage [/.when] (n.= (if choice (++ sample) sample) - (||> (/.push sample) - (/.push choice) - (/.push (/.apply_1 ++)) - /.when))) + (/.value (|>> (/.push sample) + (/.push choice) + (/.push (/.apply_1 ++)) + /.when)))) (_.coverage [/.?] (n.= (if choice (++ sample) (-- sample)) - (||> (/.push choice) - (/.push (++ sample)) - (/.push (-- sample)) - /.?))) + (/.value (|>> (/.push choice) + (/.push (++ sample)) + (/.push (-- sample)) + /.?)))) ))) -(word: square +(def: square (=> [Nat] [Nat]) - - /.dup - (/.apply_2 n.*)) + (|>> /.dup + (/.apply_2 n.*))) (def: definition Test (do random.monad [sample random.nat] - (_.coverage [/.word: /.=> /.||>] + (_.coverage [/.=> /.value] (n.= (n.* sample sample) - (||> (/.push sample) - ..square))))) + (/.value (|>> (/.push sample) + ..square)))))) (def: .public test Test |