aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/test
diff options
context:
space:
mode:
authorEduardo Julian2021-08-24 05:23:45 -0400
committerEduardo Julian2021-08-24 05:23:45 -0400
commit36303d6cb2ce3ab9e36d045b9516c997bd461862 (patch)
treeb9d2f1495143054d61d9af129f36833624db9dac /lux-jvm/test
parentec1f31b5a1492d5e0ab260397291d4449483bbd9 (diff)
Outsourced the syntax for labelled type definitions to macros.
Diffstat (limited to '')
-rw-r--r--lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux18
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/loop.lux16
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/procedure.lux2
-rw-r--r--lux-jvm/test/test/luxc/lang/translation/js.lux12
-rw-r--r--lux-jvm/test/test/luxc/lang/translation/jvm.lux36
5 files changed, 42 insertions, 42 deletions
diff --git a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
index f3af659fa..5d1fd5d7d 100644
--- a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
@@ -266,7 +266,7 @@
(let [entries (dict.entries hostAE.boxes)
num-entries (list.size entries)]
(do r.Monad<Random>
- [choice (|> r.nat (:: @ map (n/% (++ num-entries))))
+ [choice (|> r.nat (:: @ each (n/% (++ num-entries))))
#let [[unboxed boxed] (: [Text Text]
(|> entries
(list.nth choice)
@@ -278,9 +278,9 @@
(do @
[#let [cap (|>> (n/% +10) (n/max +1))]
[unboxed boxed] array-type
- size (|> r.nat (:: @ map cap))
- idx (|> r.nat (:: @ map (n/% size)))
- level (|> r.nat (:: @ map cap))
+ size (|> r.nat (:: @ each cap))
+ idx (|> r.nat (:: @ each (n/% size)))
+ level (|> r.nat (:: @ each cap))
#let [unboxedT (#.Primitive unboxed (list))
arrayT (#.Primitive "#Array" (list unboxedT))
arrayC (`' ("lux check" (+0 "#Array" (+1 (+0 (~ (code.text unboxed)) (+0)) (+0)))
@@ -343,11 +343,11 @@
unboxedC (`' ("lux check" (+0 (~ (code.text unboxed)) (+0))
("jvm object null")))]
throwable (|> r.nat
- (:: @ map (n/% (++ (list.size throwables))))
- (:: @ map (function (_ idx)
- (|> throwables
- (list.nth idx)
- (maybe.default "java.lang.Object")))))
+ (:: @ each (n/% (++ (list.size throwables))))
+ (:: @ each (function (_ idx)
+ (|> throwables
+ (list.nth idx)
+ (maybe.default "java.lang.Object")))))
#let [throwableC (`' ("lux check" (+0 (~ (code.text throwable)) (+0))
("jvm object null")))]]
($_ seq
diff --git a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
index 2b09fb3e7..48efb99c9 100644
--- a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
@@ -55,13 +55,13 @@
(-> Nat la.Analysis (r.Random la.Analysis))
(r.either (r.either (r/wrap output)
(do r.Monad<Random>
- [inputA (|> r.nat (:: @ map code.nat))
- num-cases (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
+ [inputA (|> r.nat (:: @ each code.nat))
+ num-cases (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
tests (|> (r.set number.Hash<Nat> num-cases r.nat)
- (:: @ map (|>> set.to-list (list/map code.nat))))
+ (:: @ each (|>> set.to-list (list/each code.nat))))
#let [bad-bodies (list.repeat num-cases (' []))]
good-body (gen-body arity output)
- where-to-set (|> r.nat (:: @ map (n/% num-cases)))
+ where-to-set (|> r.nat (:: @ each (n/% num-cases)))
#let [bodies (list.together (list (list.first where-to-set bad-bodies)
(list good-body)
(list.after (n/++ where-to-set) bad-bodies)))]]
@@ -92,13 +92,13 @@
(def: gen-recursion
(r.Random [Bit Nat la.Analysis])
(do r.Monad<Random>
- [arity (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
+ [arity (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
recur? r.bit
outputS (if recur?
(wrap (la.apply (list.repeat arity (' [])) (la.var 0)))
(do @
[plus-or-minus? r.bit
- how-much (|> r.nat (:: @ map (|>> (n/% arity) (n/max +1))))
+ how-much (|> r.nat (:: @ each (|>> (n/% arity) (n/max +1))))
#let [shift (if plus-or-minus? n/+ n/-)]]
(wrap (la.apply (list.repeat (shift how-much arity) (' [])) (la.var 0)))))
bodyS (gen-body arity outputS)]
@@ -107,7 +107,7 @@
(def: gen-loop
(r.Random [Bit Nat la.Analysis])
(do r.Monad<Random>
- [arity (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
+ [arity (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
recur? r.bit
self-ref? r.bit
#let [selfA (la.var 0)
@@ -116,7 +116,7 @@
(wrap (la.apply (list.repeat arity argA) selfA))
(do @
[plus-or-minus? r.bit
- how-much (|> r.nat (:: @ map (|>> (n/% arity) (n/max +1))))
+ how-much (|> r.nat (:: @ each (|>> (n/% arity) (n/max +1))))
#let [shift (if plus-or-minus? n/+ n/-)]]
(wrap (la.apply (list.repeat (shift how-much arity) (' [])) selfA))))
bodyS (gen-body arity outputS)]
diff --git a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
index 2c4c5f599..c2cf5ace9 100644
--- a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
@@ -17,7 +17,7 @@
(context: "Procedures"
(<| (times +100)
(do @
- [num-args (|> r.nat (:: @ map (n/% +10)))
+ [num-args (|> r.nat (:: @ each (n/% +10)))
nameA (r.text +5)
argsA (r.list num-args gen-primitive)]
($_ seq
diff --git a/lux-jvm/test/test/luxc/lang/translation/js.lux b/lux-jvm/test/test/luxc/lang/translation/js.lux
index 83108c594..db4d5a205 100644
--- a/lux-jvm/test/test/luxc/lang/translation/js.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/js.lux
@@ -17,7 +17,7 @@
(def: upper-alpha-ascii
(r.Random Nat)
- (|> r.nat (:: r.Functor<Random> map (|>> (n/% +91) (n/max +65)))))
+ (|> r.nat (:: r.Functor<Random> each (|>> (n/% +91) (n/max +65)))))
(def: (test-primitive-identity synthesis)
(-> Synthesis Bit)
@@ -65,7 +65,7 @@
(context: "[JS] Objects."
(<| (times +100)
(do @
- [field (:: @ map code.text (r.text' upper-alpha-ascii +5))
+ [field (:: @ each code.text (r.text' upper-alpha-ascii +5))
value r.int
#let [empty-object (` ("js object"))
object (` ("js object set" (~ field) (~ (code.int value)) (~ empty-object)))
@@ -112,12 +112,12 @@
(context: "[JS] Arrays."
(<| (times +100)
(do @
- [length (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
- idx (|> r.nat (:: @ map (n/% length)))
+ [length (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
+ idx (|> r.nat (:: @ each (n/% length)))
overwrite r.nat
elems (|> (r.set number.Hash<Nat> length r.nat)
- (:: @ map set.to-list))
- #let [arrayS (` ("js array literal" (~+ (list/map code.nat elems))))]]
+ (:: @ each set.to-list))
+ #let [arrayS (` ("js array literal" (~+ (list/each code.nat elems))))]]
($_ seq
(test "Can get the length of an array."
(|> (run-js (` ("js array length" (~ arrayS))))
diff --git a/lux-jvm/test/test/luxc/lang/translation/jvm.lux b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
index 99af8d8c9..5aee41ce5 100644
--- a/lux-jvm/test/test/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
@@ -27,7 +27,7 @@
(context: "Conversions [Part 1]"
(<| (times +100)
(do @
- [int-sample (|> r.int (:: @ map (i/% 128)))
+ [int-sample (|> r.int (:: @ each (i/% 128)))
#let [frac-sample (int-to-frac int-sample)]]
(with-expansions [<2step> (template [<step1> <step2> <tag> <sample> <cast> <test>]
[(test (format <step1> " / " <step2>)
@@ -58,7 +58,7 @@
(context: "Conversions [Part 2]"
(<| (times +100)
(do @
- [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs)))
+ [int-sample (|> r.int (:: @ each (|>> (i/% 128) int/abs)))
#let [frac-sample (int-to-frac int-sample)]]
(`` ($_ seq
(~~ (template [<step1> <step2> <step3> <tag> <sample> <cast> <test>]
@@ -85,7 +85,7 @@
(context: "Conversions [Part 3]"
(<| (times +100)
(do @
- [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs)))
+ [int-sample (|> r.int (:: @ each (|>> (i/% 128) int/abs)))
#let [frac-sample (int-to-frac int-sample)]]
(`` ($_ seq
(~~ (template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>]
@@ -110,16 +110,16 @@
(def: gen-nat
(r.Random Nat)
(|> r.nat
- (r/map (n/% +128))
+ (r/each (n/% +128))
(r.filter (|>> (n/= +0) not))))
(def: gen-int
(r.Random Int)
- (|> gen-nat (r/map nat-to-int)))
+ (|> gen-nat (r/each nat-to-int)))
(def: gen-frac
(r.Random Frac)
- (|> gen-int (r/map int-to-frac)))
+ (|> gen-int (r/each int-to-frac)))
(template [<domain> <generator> <tag> <type> <test> <augmentation> <+> <-> <*> </> <%> <pre> <post>]
[(context: (format "Arithmetic [" <domain> "]")
@@ -277,8 +277,8 @@
(context: "Array [Part 1]"
(<| (times +100)
(do @
- [size (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
- idx (|> r.nat (:: @ map (n/% size)))
+ [size (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
+ idx (|> r.nat (:: @ each (n/% size)))
valueZ r.bit
valueB gen-int
valueS gen-int
@@ -325,8 +325,8 @@
(context: "Array [Part 2]"
(<| (times +100)
(do @
- [size (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
- idx (|> r.nat (:: @ map (n/% size)))
+ [size (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
+ idx (|> r.nat (:: @ each (n/% size)))
valueZ r.bit
valueB gen-int
valueS gen-int
@@ -401,10 +401,10 @@
(def: instances
(List [Text (r.Random ls.Synthesis)])
- (let [gen-boolean (|> r.bit (:: r.Functor<Random> map code.bit))
- gen-integer (|> r.int (:: r.Functor<Random> map code.int))
- gen-double (|> r.frac (:: r.Functor<Random> map code.frac))
- gen-string (|> (r.text +5) (:: r.Functor<Random> map code.text))]
+ (let [gen-boolean (|> r.bit (:: r.Functor<Random> each code.bit))
+ gen-integer (|> r.int (:: r.Functor<Random> each code.int))
+ gen-double (|> r.frac (:: r.Functor<Random> each code.frac))
+ gen-string (|> (r.text +5) (:: r.Functor<Random> each code.text))]
(list ["java.lang.Boolean" gen-boolean]
["java.lang.Long" gen-integer]
["java.lang.Double" gen-double]
@@ -419,8 +419,8 @@
(do @
[#let [num-classes (list.size classes)]
#let [num-instances (list.size instances)]
- class-idx (|> r.nat (:: @ map (n/% num-classes)))
- instance-idx (|> r.nat (:: @ map (n/% num-instances)))
+ class-idx (|> r.nat (:: @ each (n/% num-classes)))
+ instance-idx (|> r.nat (:: @ each (n/% num-instances)))
exception-message (r.text +5)
#let [class (maybe.trusted (list.nth class-idx classes))
[instance-class instance-gen] (maybe.trusted (list.nth instance-idx instances))
@@ -512,7 +512,7 @@
(context: "Member [Field]"
(<| (times +100)
(do @
- [sample-short (|> r.int (:: @ map (|>> int/abs (i/% 100))))
+ [sample-short (|> r.int (:: @ each (|>> int/abs (i/% 100))))
sample-string (r.text +5)
other-sample-string (r.text +5)
#let [shortS (` ["short" ("jvm object cast" "java.lang.Short" "short"
@@ -581,7 +581,7 @@
(context: "Member [Method]"
(<| (times +100)
(do @
- [sample (|> r.int (:: @ map (|>> int/abs (i/% 100))))
+ [sample (|> r.int (:: @ each (|>> int/abs (i/% 100))))
#let [object-longS (` ["java.lang.Object" (~ (code.int sample))])
intS (` ["int" ("jvm object cast" "java.lang.Integer" "int"
("jvm convert long-to-int" (~ (code.int sample))))])