From 72b4eecdc514387ab3b1c105cfd49436c9eb1e8d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 25 Oct 2020 05:10:08 -0400 Subject: Some improvements to the Lux syntax parser. --- stdlib/source/test/aedifex.lux | 2 + stdlib/source/test/aedifex/input.lux | 51 ++++++ stdlib/source/test/lux/abstract.lux | 2 - stdlib/source/test/lux/abstract/hash.lux | 35 ---- stdlib/source/test/lux/data/collection/row.lux | 206 ++++++++++++++++------ stdlib/source/test/lux/macro/code.lux | 20 +-- stdlib/source/test/lux/macro/poly/equivalence.lux | 20 ++- stdlib/source/test/lux/macro/syntax/common.lux | 14 +- stdlib/source/test/lux/math.lux | 16 +- stdlib/source/test/lux/math/logic/fuzzy.lux | 4 +- stdlib/source/test/lux/target/jvm.lux | 50 +++--- 11 files changed, 275 insertions(+), 145 deletions(-) create mode 100644 stdlib/source/test/aedifex/input.lux delete mode 100644 stdlib/source/test/lux/abstract/hash.lux (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux index 50d194e43..fd92d9b40 100644 --- a/stdlib/source/test/aedifex.lux +++ b/stdlib/source/test/aedifex.lux @@ -7,6 +7,7 @@ [cli (#+ program:)]]]] ["." / #_ ["#." artifact] + ["#." input] ["#." command #_ ["#/." pom]] ["#." dependency] @@ -21,6 +22,7 @@ Test ($_ _.and /artifact.test + /input.test /command/pom.test /dependency.test /profile.test diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux new file mode 100644 index 000000000..39a71eb81 --- /dev/null +++ b/stdlib/source/test/aedifex/input.lux @@ -0,0 +1,51 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [control + ["." try (#+ Try) ("#@." functor)] + [concurrency + ["." promise (#+ Promise)]] + [security + ["!" capability]]] + [data + ["." binary] + ["." text ("#@." equivalence) + ["%" format] + ["." encoding]]] + [math + ["." random (#+ Random)]] + [world + ["." file (#+ File)]]] + [// + ["@." profile]] + {#program + ["." / + ["/#" // #_ + ["#" profile (#+ Profile)] + ["#." project] + ["#." action] + ["#." format]]]}) + +(def: #export test + Test + (<| (_.covering /._) + (do {@ random.monad} + [expected (:: @ map (set@ #//.parents (list)) @profile.random) + #let [fs (: (file.System Promise) + (file.mock (:: file.system separator)))]] + (wrap (do promise.monad + [verdict (do //action.monad + [file (: (Promise (Try (File Promise))) + (file.get-file promise.monad fs //project.file)) + _ (|> expected + //format.profile + %.code + encoding.to-utf8 + (!.use (:: file over-write))) + actual (: (Promise (Try Profile)) + (/.read promise.monad fs //.default))] + (wrap (:: //.equivalence = expected actual)))] + (_.claim [/.read] + (try.default false verdict))))))) diff --git a/stdlib/source/test/lux/abstract.lux b/stdlib/source/test/lux/abstract.lux index 12c3625b3..d99d3c063 100644 --- a/stdlib/source/test/lux/abstract.lux +++ b/stdlib/source/test/lux/abstract.lux @@ -10,7 +10,6 @@ ["#." fold] ["#." functor ["#/." contravariant]] - ["#." hash] ["#." interval] ["#." monad ["#/." free]] @@ -42,7 +41,6 @@ /equivalence.test /fold.test ..functor - /hash.test /interval.test ..monad /monoid.test diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux deleted file mode 100644 index f7f82ffe2..000000000 --- a/stdlib/source/test/lux/abstract/hash.lux +++ /dev/null @@ -1,35 +0,0 @@ -(.module: - [lux #* - ["_" test (#+ Test)] - [abstract - [monad (#+ do)]] - [data - ["." bit ("#@." equivalence)] - [number - ["n" nat] - ["i" int]]] - [math - ["." random]]] - {1 - ["." /]}) - -(def: #export test - Test - (do random.monad - [left random.nat - right random.int - other-left random.nat - other-right random.int] - (<| (_.covering /._) - ($_ _.and - (_.cover [/.product] - (and (n.= (:: (/.product n.hash i.hash) hash [left right]) - (n.* (:: n.hash hash left) - (:: i.hash hash right))) - (bit@= (:: (/.product n.hash i.hash) = [left right] [left right]) - (and (:: n.hash = left left) - (:: i.hash = right right))) - (bit@= (:: (/.product n.hash i.hash) = [left right] [other-left other-right]) - (and (:: n.hash = left other-left) - (:: i.hash = right other-right))))) - )))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 1a9cfd383..e096c9085 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -1,6 +1,5 @@ (.module: [lux #* - ["%" data/text/format (#+ format)] ["_" test (#+ Test)] [abstract [monad (#+ do)] @@ -13,69 +12,176 @@ ["$." apply] ["$." monad]]}] [control - ["." try]] + ["." try (#+ Try)] + ["." exception]] [data + ["." bit ("#@." equivalence)] [number ["n" nat]] [collection - ["." list ("#@." fold)]]] + ["." list ("#@." fold)] + ["." set]]] [math - ["r" random]]] + ["." random]]] {1 ["." / ("#@." monad)]}) +(def: signatures + Test + (do {@ random.monad} + [size (:: @ map (n.% 100) random.nat)] + ($_ _.and + (_.with-cover [/.equivalence] + ($equivalence.spec (/.equivalence n.equivalence) (random.row size random.nat))) + (_.with-cover [/.monoid] + ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.row size random.nat))) + (_.with-cover [/.fold] + ($fold.spec /@wrap /.equivalence /.fold)) + (_.with-cover [/.functor] + ($functor.spec /@wrap /.equivalence /.functor)) + (_.with-cover [/.apply] + ($apply.spec /@wrap /.equivalence /.apply)) + (_.with-cover [/.monad] + ($monad.spec /@wrap /.equivalence /.monad)) + ))) + +(def: whole + Test + (do {@ random.monad} + [size (:: @ map (n.% 100) random.nat) + sample (random.set n.hash size random.nat) + #let [sample (|> sample set.to-list /.from-list)] + #let [(^open "/@.") (/.equivalence n.equivalence)]] + ($_ _.and + (_.cover [/.size] + (n.= size (/.size sample))) + (_.cover [/.empty?] + (bit@= (/.empty? sample) (n.= 0 (/.size sample)))) + (_.cover [/.empty] + (/.empty? /.empty)) + (_.cover [/.to-list /.from-list] + (|> sample /.to-list /.from-list (/@= sample))) + (_.cover [/.reverse] + (or (n.< 2 (/.size sample)) + (let [not-same! + (not (/@= sample + (/.reverse sample))) + + self-symmetry! + (/@= sample + (/.reverse (/.reverse sample)))] + (and not-same! + self-symmetry!)))) + (_.cover [/.every? /.any?] + (if (/.every? n.even? sample) + (not (/.any? (bit.complement n.even?) sample)) + (/.any? (bit.complement n.even?) sample))) + ))) + +(def: index-based + Test + (do {@ random.monad} + [size (:: @ map (|>> (n.% 100) inc) random.nat)] + ($_ _.and + (do @ + [good-index (|> random.nat (:: @ map (n.% size))) + #let [bad-index (n.+ size good-index)] + sample (random.set n.hash size random.nat) + non-member (random.filter (|>> (set.member? sample) not) + random.nat) + #let [sample (|> sample set.to-list /.from-list)]] + ($_ _.and + (_.cover [/.nth] + (case (/.nth good-index sample) + (#try.Success member) + (/.member? n.equivalence sample member) + + (#try.Failure error) + false)) + (_.cover [/.put] + (<| (try.default false) + (do try.monad + [sample (/.put good-index non-member sample) + actual (/.nth good-index sample)] + (wrap (is? non-member actual))))) + (_.cover [/.update] + (<| (try.default false) + (do try.monad + [sample (/.put good-index non-member sample) + sample (/.update good-index inc sample) + actual (/.nth good-index sample)] + (wrap (n.= (inc non-member) actual))))) + (_.cover [/.within-bounds?] + (and (/.within-bounds? sample good-index) + (not (/.within-bounds? sample bad-index)))) + (_.cover [/.index-out-of-bounds] + (let [fails! (: (All [a] (-> (Try a) Bit)) + (function (_ situation) + (case situation + (#try.Success member) + false + + (#try.Failure error) + (exception.match? /.index-out-of-bounds error))))] + (and (fails! (/.nth bad-index sample)) + (fails! (/.put bad-index non-member sample)) + (fails! (/.update bad-index inc sample))))) + )) + ))) + (def: #export test Test - (<| (_.context (%.name (name-of /._))) - (do {@ r.monad} - [size (|> r.nat (:: @ map (|>> (n.% 100) (n.max 10))))] + (<| (_.covering /._) + (_.with-cover [/.Row]) + (do {@ random.monad} + [size (:: @ map (|>> (n.% 100) inc) random.nat)] ($_ _.and - ($equivalence.spec (/.equivalence n.equivalence) (r.row size r.nat)) - ($monoid.spec (/.equivalence n.equivalence) /.monoid (r.row size r.nat)) - ($fold.spec /@wrap /.equivalence /.fold) - ($functor.spec /@wrap /.equivalence /.functor) - ($apply.spec /@wrap /.equivalence /.apply) - ($monad.spec /@wrap /.equivalence /.monad) + ..signatures + ..whole + ..index-based (do @ - [idx (|> r.nat (:: @ map (n.% size))) - sample (r.row size r.nat) - other-sample (r.row size r.nat) - non-member (|> r.nat (r.filter (|>> (/.member? n.equivalence sample) not))) + [sample (random.set n.hash size random.nat) + non-member (random.filter (|>> (set.member? sample) not) + random.nat) + #let [sample (|> sample set.to-list /.from-list)] #let [(^open "/@.") (/.equivalence n.equivalence)]] ($_ _.and - (_.test (format (%.name (name-of /.size)) - " " (%.name (name-of /.empty?))) - (if (/.empty? sample) - (and (n.= 0 size) - (n.= 0 (/.size sample))) - (n.= size (/.size sample)))) - (_.test (format (%.name (name-of /.add)) - " " (%.name (name-of /.pop))) - (and (n.= (inc size) (/.size (/.add non-member sample))) - (n.= (dec size) (/.size (/.pop sample))))) - (_.test (format (%.name (name-of /.put)) - " &&& " (%.name (name-of /.nth))) - (|> sample - (/.put idx non-member) try.assume - (/.nth idx) try.assume - (is? non-member))) - (_.test (%.name (name-of /.update)) - (|> sample - (/.put idx non-member) try.assume - (/.update idx inc) try.assume - (/.nth idx) try.assume - (n.= (inc non-member)))) - (_.test (format (%.name (name-of /.to-list)) - " &&& " (%.name (name-of /.from-list))) - (|> sample /.to-list /.from-list (/@= sample))) - (_.test (%.name (name-of /.member?)) - (and (not (/.member? n.equivalence sample non-member)) - (/.member? n.equivalence (/.add non-member sample) non-member))) - (_.test (%.name (name-of /.reverse)) - (and (not (/@= sample - (/.reverse sample))) - (/@= sample - (/.reverse (/.reverse sample))))) + (do @ + [value/0 random.nat + value/1 random.nat + value/2 random.nat] + (_.cover [/.row] + (/@= (/.from-list (list value/0 value/1 value/2)) + (/.row value/0 value/1 value/2)))) + (_.cover [/.member?] + (and (list.every? (/.member? n.equivalence sample) + (/.to-list sample)) + (not (/.member? n.equivalence sample non-member)))) + (_.cover [/.add] + (let [added (/.add non-member sample) + + size-increases! + (n.= (inc (/.size sample)) + (/.size added)) + + is-a-member! + (/.member? n.equivalence added non-member)] + (and size-increases! + is-a-member!))) + (_.cover [/.pop] + (if (/.empty? sample) + (/.empty? (/.pop sample)) + (let [expected-size! + (n.= (dec (/.size sample)) + (/.size (/.pop sample))) + + symmetry! + (|> sample + (/.add non-member) + /.pop + (/@= sample))] + (and expected-size! + symmetry!)))) )) )))) diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index f6a1ca855..52955680e 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -37,14 +37,14 @@ (def: (random-sequence random) (All [a] (-> (Random a) (Random (List a)))) - (do {@ random.monad} - [size (|> random.nat (:: @ map (n.% 3)))] + (do {! random.monad} + [size (|> random.nat (:: ! map (n.% 3)))] (random.list size random))) (def: (random-record random) (All [a] (-> (Random a) (Random (List [a a])))) - (do {@ random.monad} - [size (|> random.nat (:: @ map (n.% 3)))] + (do {! random.monad} + [size (|> random.nat (:: ! map (n.% 3)))] (random.list size (random.and random random)))) (def: #export random @@ -85,13 +85,13 @@ (function (_ replace-simulation) (let [for-sequence (: (-> (-> (List Code) Code) (Random [Code Code])) (function (_ to-code) - (do {@ random.monad} + (do {! random.monad} [parts (..random-sequence replace-simulation)] (wrap [(to-code (list@map product.left parts)) (to-code (list@map product.right parts))]))))] ($_ random.either (random@wrap [original substitute]) - (do {@ random.monad} + (do {! random.monad} [sample (random.filter (|>> (:: /.equivalence = original) not) ($_ random.either (random@map /.bit random.bit) @@ -105,7 +105,7 @@ (wrap [sample sample])) (for-sequence /.form) (for-sequence /.tuple) - (do {@ random.monad} + (do {! random.monad} [parts (..random-sequence replace-simulation)] (wrap [(/.record (let [parts' (list@map product.left parts)] (list.zip/2 parts' parts'))) @@ -122,7 +122,7 @@ (_.with-cover [/.format] (`` ($_ _.and (~~ (template [ ] - [(do {@ random.monad} + [(do {! random.monad} [expected ] (_.cover [] (and (case (..read (/.format ( expected))) @@ -149,7 +149,7 @@ [/.tuple (..random-sequence ..random) #.Tuple] [/.record (..random-record ..random) #.Record])) (~~ (template [ ] - [(do {@ random.monad} + [(do {! random.monad} [expected ] (_.cover [] (and (case (..read (/.format ( expected))) @@ -168,7 +168,7 @@ [/.local-tag ..random-text #.Tag] [/.local-identifier ..random-text #.Identifier] ))))) - (do {@ random.monad} + (do {! random.monad} [[original substitute] (random.and ..random ..random) [sample expected] (..replace-simulation [original substitute])] (_.cover [/.replace] diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index bfd0a2540..985da657c 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -44,8 +44,9 @@ (def: gen-recursive (Random Recursive) (random.rec (function (_ gen-recursive) - (random.or random.frac - (random.and random.frac gen-recursive))))) + (random.or random.safe-frac + (random.and random.safe-frac + gen-recursive))))) (def: gen-record (Random Record) @@ -55,15 +56,22 @@ ($_ random.and random.bit gen-int - random.frac + random.safe-frac (random.unicode size) (random.maybe gen-int) (random.list size gen-int) - ($_ random.or random.bit gen-int random.frac) - ($_ random.and gen-int random.frac (random.unicode size)) + ($_ random.or + random.bit + gen-int + random.safe-frac) + ($_ random.and + gen-int + random.safe-frac + (random.unicode size)) gen-recursive))) -(derived: equivalence (/.equivalence Record)) +(derived: equivalence + (/.equivalence Record)) (def: #export test Test diff --git a/stdlib/source/test/lux/macro/syntax/common.lux b/stdlib/source/test/lux/macro/syntax/common.lux index 1aaf851a9..d50b94eaa 100644 --- a/stdlib/source/test/lux/macro/syntax/common.lux +++ b/stdlib/source/test/lux/macro/syntax/common.lux @@ -44,8 +44,8 @@ (def: random-annotations (Random /.Annotations) - (do {@ random.monad} - [size (:: @ map (|>> (n.% 3)) random.nat)] + (do {! random.monad} + [size (:: ! map (|>> (n.% 3)) random.nat)] (random.list size (random.and random-name ///code.random)))) @@ -89,8 +89,8 @@ (#try.Failure error) false))) )) - (do {@ random.monad} - [size (:: @ map (|>> (n.% 3)) random.nat) + (do {! random.monad} + [size (:: ! map (|>> (n.% 3)) random.nat) expected (random.list size ..random-text)] (_.cover [/.Type-Var /reader.type-variables /writer.type-variables] (|> expected @@ -101,8 +101,8 @@ (#try.Failure error) false)))) - (do {@ random.monad} - [size (:: @ map (|>> (n.% 3)) random.nat) + (do {! random.monad} + [size (:: ! map (|>> (n.% 3)) random.nat) expected (: (Random /.Declaration) (random.and ..random-text (random.list size ..random-text)))] @@ -117,7 +117,7 @@ (#try.Failure error) false)))) - (do {@ random.monad} + (do {! random.monad} [expected (: (Random /.Typed-Input) (random.and ///code.random ///code.random))] diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux index c29b25b97..673099c34 100644 --- a/stdlib/source/test/lux/math.lux +++ b/stdlib/source/test/lux/math.lux @@ -36,8 +36,8 @@ (<| (_.context (%.name (name-of /._))) ($_ _.and (<| (_.context "Trigonometry") - (do {@ r.monad} - [angle (|> r.safe-frac (:: @ map (f.* /.tau)))] + (do {! r.monad} + [angle (|> r.safe-frac (:: ! map (f.* /.tau)))] ($_ _.and (_.test "Sine and arc-sine are inverse functions." (trigonometric-symmetry /.sin /.asin angle)) @@ -47,8 +47,8 @@ (trigonometric-symmetry /.tan /.atan angle)) ))) (<| (_.context "Rounding") - (do {@ r.monad} - [sample (|> r.safe-frac (:: @ map (f.* +1000.0)))] + (do {! r.monad} + [sample (|> r.safe-frac (:: ! map (f.* +1000.0)))] ($_ _.and (_.test "The ceiling will be an integer value, and will be >= the original." (let [ceil'd (/.ceil sample)] @@ -66,13 +66,13 @@ (f.<= +1.0 (f.abs (f.- sample round'd)))))) ))) (<| (_.context "Exponentials and logarithms") - (do {@ r.monad} - [sample (|> r.safe-frac (:: @ map (f.* +10.0)))] + (do {! r.monad} + [sample (|> r.safe-frac (:: ! map (f.* +10.0)))] (_.test "Logarithm is the inverse of exponential." (|> sample /.exp /.log (within? +0.000000000000001 sample))))) (<| (_.context "Greatest-Common-Divisor and Least-Common-Multiple") - (do {@ r.monad} - [#let [gen-nat (|> r.nat (:: @ map (|>> (n.% 1000) (n.max 1))))] + (do {! r.monad} + [#let [gen-nat (|> r.nat (:: ! map (|>> (n.% 1000) (n.max 1))))] x gen-nat y gen-nat] ($_ _.and diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index d692cb3f4..16e9116c1 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -143,9 +143,9 @@ (def: predicates-and-sets Test - (do {@ random.monad} + (do {! random.monad} [#let [set-10 (set.from-list n.hash (enum.range n.enum 0 10))] - sample (|> random.nat (:: @ map (n.% 20)))] + sample (|> random.nat (:: ! map (n.% 20)))] ($_ _.and (_.test (%.name (name-of /.from-predicate)) (bit@= (r.= //.true (/.membership sample (/.from-predicate n.even?))) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 4eefd9e03..3a98b5380 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -299,8 +299,8 @@ (template [ ] [(def: Test - (do {@ random.monad} - [expected (:: @ map (i64.and (i64.mask )) random.nat)] + (do {! random.monad} + [expected (:: ! map (i64.and (i64.mask )) random.nat)] (<| (_.lift ) (..bytecode (for {@.old (|>> (:coerce ) ("jvm leq" expected)) @@ -377,8 +377,8 @@ instruction))))) shift (: (-> (-> java/lang/Integer java/lang/Integer java/lang/Integer) (Bytecode Any) (Random Bit)) (function (_ reference instruction) - (do {@ random.monad} - [parameter (:: @ map (|>> (n.% 32) .int (:coerce java/lang/Long) host.long-to-int) random.nat) + (do {! random.monad} + [parameter (:: ! map (|>> (n.% 32) .int (:coerce java/lang/Long) host.long-to-int) random.nat) subject ..$Integer::random] (int (reference parameter subject) (do /.monad @@ -456,8 +456,8 @@ instruction))))) shift (: (-> (-> java/lang/Integer java/lang/Long java/lang/Long) (Bytecode Any) (Random Bit)) (function (_ reference instruction) - (do {@ random.monad} - [parameter (:: @ map (|>> (n.% 64) (:coerce java/lang/Long)) random.nat) + (do {! random.monad} + [parameter (:: ! map (|>> (n.% 64) (:coerce java/lang/Long)) random.nat) subject ..$Long::random] (long (reference (host.long-to-int parameter) subject) (do /.monad @@ -937,8 +937,8 @@ (-> a Any Bit) Test)) (function (_ constructor random literal [*store *load *wrap] test) - (do {@ random.monad} - [size (:: @ map (|>> (n.% 1024) (n.max 1)) random.nat) + (do {! random.monad} + [size (:: ! map (|>> (n.% 1024) (n.max 1)) random.nat) value random] ($_ _.and (<| (_.lift "length") @@ -1009,12 +1009,12 @@ (array (/.anewarray ..$String) $String::random $String::literal [/.aastore /.aaload /.nop] (function (_ expected) (|>> (:coerce Text) (text@= (:coerce Text expected)))))) (<| (_.context "multi") - (do {@ random.monad} - [#let [size (:: @ map (|>> (n.% 10) (n.+ 1)) + (do {! random.monad} + [#let [size (:: ! map (|>> (n.% 10) (n.+ 1)) random.nat)] dimensions size sizesH size - sizesT (monad.seq @ (list.repeat (dec dimensions) size)) + sizesT (monad.seq ! (list.repeat (dec dimensions) size)) #let [type (loop [dimensions dimensions type (: (Type Object) ..$Object)] @@ -1023,8 +1023,8 @@ _ (recur (dec dimensions) (/type.array type))))]] (<| (_.lift "MULTIANEWARRAY") (..bytecode (|>> (:coerce Nat) (n.= sizesH))) - (do {@ /.monad} - [_ (monad.map @ (|>> (:coerce java/lang/Long) host.long-to-int ..$Integer::literal) + (do {! /.monad} + [_ (monad.map ! (|>> (:coerce java/lang/Long) host.long-to-int ..$Integer::literal) (#.Cons sizesH sizesT)) _ (/.multianewarray type (|> dimensions /unsigned.u1 try.assume)) _ ?length] @@ -1121,9 +1121,9 @@ (-> a (-> Any Bit)) (Random Bit))) (function (_ random-value literal *wrap [store load] test) - (do {@ random.monad} + (do {! random.monad} [expected random-value - register (:: @ map (n.% 128) random.nat)] + register (:: ! map (n.% 128) random.nat)] (<| (..bytecode (test expected)) (do /.monad [_ (literal expected) @@ -1145,9 +1145,9 @@ (_.lift "ISTORE/ILOAD" (store-and-load ..$Integer::random ..$Integer::literal ..$Integer::wrap [/.istore /.iload] test)) (_.lift "IINC" - (do {@ random.monad} + (do {! random.monad} [base ..$Byte::random - increment (:: @ map (|>> (n.% 100) /unsigned.u1 try.assume) + increment (:: ! map (|>> (n.% 100) /unsigned.u1 try.assume) random.nat) #let [expected (: java/lang/Long (for {@.old @@ -1468,12 +1468,12 @@ Test ($_ _.and (<| (_.lift "TABLESWITCH") - (do {@ random.monad} + (do {! random.monad} [expected ..$Long::random dummy ..$Long::random - minimum (:: @ map (|>> (n.% 100) .int /signed.s4 try.assume) + minimum (:: ! map (|>> (n.% 100) .int /signed.s4 try.assume) random.nat) - afterwards (:: @ map (n.% 10) random.nat)]) + afterwards (:: ! map (n.% 10) random.nat)]) (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) (do /.monad [@right /.new-label @@ -1489,14 +1489,14 @@ _ (/.set-label @return)] ..$Long::wrap)) (<| (_.lift "LOOKUPSWITCH") - (do {@ random.monad} - [options (:: @ map (|>> (n.% 10) (n.+ 1)) + (do {! random.monad} + [options (:: ! map (|>> (n.% 10) (n.+ 1)) random.nat) - choice (:: @ map (n.% options) random.nat) + choice (:: ! map (n.% options) random.nat) options (|> random.int - (:: @ map (|>> (:coerce java/lang/Long) host.long-to-int host.int-to-long (:coerce Int))) + (:: ! map (|>> (:coerce java/lang/Long) host.long-to-int host.int-to-long (:coerce Int))) (random.set i.hash options) - (:: @ map set.to-list)) + (:: ! map set.to-list)) #let [choice (maybe.assume (list.nth choice options))] expected ..$Long::random dummy ..$Long::random]) -- cgit v1.2.3