diff options
author | Eduardo Julian | 2017-10-30 21:49:35 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-30 21:49:35 -0400 |
commit | b6c3a84b536235a53bdfaf0f96d76413bc222ba7 (patch) | |
tree | 6295ffe197e98fc998f1553fed14b44114fbfc8b /new-luxc/test/test/luxc/generator/procedure/host.jvm.lux | |
parent | 7b870a7bd124f35939d9089a2e21f0806a4c6e85 (diff) |
- Migrated the format of synthesis nodes from a custom data-type, to just Code nodes.
Diffstat (limited to 'new-luxc/test/test/luxc/generator/procedure/host.jvm.lux')
-rw-r--r-- | new-luxc/test/test/luxc/generator/procedure/host.jvm.lux | 452 |
1 files changed, 217 insertions, 235 deletions
diff --git a/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux b/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux index 7a047dff9..153f276cc 100644 --- a/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux +++ b/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux @@ -12,7 +12,8 @@ text/format (coll [list])) ["r" math/random "r/" Monad<Random>] - [meta #+ Monad<Meta>] + [meta] + (meta [code]) [host] test) (luxc [";L" host] @@ -33,9 +34,7 @@ (with-expansions [<2step> (do-template [<step1> <step2> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2>) (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (<tag> <sample>) - (list) (#ls;Procedure <step1>) - (list) (#ls;Procedure <step2>)))] + [sampleI (@;generate (|> (~ (<tag> <sample>)) <step1> <step2> (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success valueG) @@ -44,14 +43,14 @@ (#e;Error error) false)))] - ["jvm convert double-to-float" "jvm convert float-to-double" #ls;Frac frac-sample Frac f.=] - ["jvm convert double-to-int" "jvm convert int-to-double" #ls;Frac frac-sample Frac f.=] - ["jvm convert double-to-long" "jvm convert long-to-double" #ls;Frac frac-sample Frac f.=] + ["jvm convert double-to-float" "jvm convert float-to-double" code;frac frac-sample Frac f.=] + ["jvm convert double-to-int" "jvm convert int-to-double" code;frac frac-sample Frac f.=] + ["jvm convert double-to-long" "jvm convert long-to-double" code;frac frac-sample Frac f.=] - ["jvm convert long-to-float" "jvm convert float-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-int" "jvm convert int-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-short" "jvm convert short-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-byte" "jvm convert byte-to-long" #ls;Int int-sample Int i.=] + ["jvm convert long-to-float" "jvm convert float-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-int" "jvm convert int-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-short" "jvm convert short-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-byte" "jvm convert byte-to-long" code;int int-sample Int i.=] )] ($_ seq <2step> @@ -62,52 +61,50 @@ (do @ [int-sample (|> r;int (:: @ map (|>. (i.% 128) int/abs))) #let [frac-sample (int-to-frac int-sample)]] - (with-expansions [<3step> (do-template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] - [(test (format <step1> " / " <step2> " / " <step3>) - (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (<tag> <sample>) - (list) (#ls;Procedure <step1>) - (list) (#ls;Procedure <step2>) - (list) (#ls;Procedure <step3>)))] - (@eval;eval sampleI)) - (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> <sample> (:! <cast> valueG)) - - (#e;Error error) - false)))] - - ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-int" "jvm convert int-to-byte" "jvm convert byte-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-int" "jvm convert int-to-short" "jvm convert short-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-float" "jvm convert float-to-int" "jvm convert int-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-int" "jvm convert int-to-float" "jvm convert float-to-long" #ls;Int int-sample Int i.=] - ) - <4step> (do-template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] - [(test (format <step1> " / " <step2> " / " <step3>) - (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (<tag> <sample>) - (list) (#ls;Procedure <step1>) - (list) (#ls;Procedure <step2>) - (list) (#ls;Procedure <step3>) - (list) (#ls;Procedure <step4>)))] - (@eval;eval sampleI)) - (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> <sample> (:! <cast> valueG)) - - (#e;Error error) - false)))] - - ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-byte" "jvm convert byte-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-short" "jvm convert short-to-long" #ls;Int int-sample Int i.=] - ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-int" "jvm convert int-to-long" #ls;Int int-sample Int i.=] - ) - ] - ($_ seq - <3step> - <4step> - ))))) + (`` ($_ seq + (~~ (do-template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] + [(test (format <step1> " / " <step2> " / " <step3>) + (|> (do meta;Monad<Meta> + [sampleI (@;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> (`)))] + (@eval;eval sampleI)) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) + (<test> <sample> (:! <cast> valueG)) + + (#e;Error error) + false)))] + + ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-int" "jvm convert int-to-byte" "jvm convert byte-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-int" "jvm convert int-to-short" "jvm convert short-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-float" "jvm convert float-to-int" "jvm convert int-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-int" "jvm convert int-to-float" "jvm convert float-to-long" code;int int-sample Int i.=] + )) + ))))) + +(context: "Conversions [Part 3]" + (<| (times +100) + (do @ + [int-sample (|> r;int (:: @ map (|>. (i.% 128) int/abs))) + #let [frac-sample (int-to-frac int-sample)]] + (`` ($_ seq + (~~ (do-template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] + [(test (format <step1> " / " <step2> " / " <step3>) + (|> (do meta;Monad<Meta> + [sampleI (@;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> <step4> (`)))] + (@eval;eval sampleI)) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) + (<test> <sample> (:! <cast> valueG)) + + (#e;Error error) + false)))] + + ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-byte" "jvm convert byte-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-short" "jvm convert short-to-long" code;int int-sample Int i.=] + ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-int" "jvm convert int-to-long" code;int int-sample Int i.=] + )) + ))))) (def: gen-nat (r;Random Nat) @@ -132,8 +129,9 @@ (with-expansions [<tests> (do-template [<procedure> <reference>] [(test <procedure> (|> (do meta;Monad<Meta> - [sampleI (@;generate (<post> (#ls;Procedure <procedure> (list (<pre> (<tag> subject)) - (<pre> (<tag> param))))))] + [sampleI (@;generate (` (<post> ((~ (code;text <procedure>)) + (<pre> (~ (<tag> subject))) + (<pre> (~ (<tag> param)))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success valueG) @@ -153,64 +151,75 @@ <tests> )))))] - ["int" gen-int #ls;Int Int i.= (i.* 10) i.+ i.- i.* i./ i.% (|>. (list) (#ls;Procedure "jvm convert long-to-int")) (|>. (list) (#ls;Procedure "jvm convert int-to-long"))] - ["long" gen-int #ls;Int Int i.= (i.* 10) i.+ i.- i.* i./ i.% id id] - ["float" gen-frac #ls;Frac Frac f.= (f.* 10.0) f.+ f.- f.* f./ f.% (|>. (list) (#ls;Procedure "jvm convert double-to-float")) (|>. (list) (#ls;Procedure "jvm convert float-to-double"))] - ["double" gen-frac #ls;Frac Frac f.= (f.* 10.0) f.+ f.- f.* f./ f.% id id] + ["int" gen-int code;int Int i.= (i.* 10) i.+ i.- i.* i./ i.% "jvm convert long-to-int" "jvm convert int-to-long"] + ["long" gen-int code;int Int i.= (i.* 10) i.+ i.- i.* i./ i.% "lux noop" "lux noop"] + ["float" gen-frac code;frac Frac f.= (f.* 10.0) f.+ f.- f.* f./ f.% "jvm convert double-to-float" "jvm convert float-to-double"] + ["double" gen-frac code;frac Frac f.= (f.* 10.0) f.+ f.- f.* f./ f.% "lux noop" "lux noop"] + ) + +(do-template [<domain> <post> <convert>] + [(context: (format "Bit-wise [" <domain> "] { Combiners ]") + (<| (times +100) + (do @ + [param gen-nat + subject gen-nat] + (`` ($_ seq + (~~ (do-template [<procedure> <reference>] + [(test <procedure> + (|> (do meta;Monad<Meta> + [sampleI (@;generate (` (<post> ((~ (code;text <procedure>)) + (<convert> (~ (code;nat subject))) + (<convert> (~ (code;nat param)))))))] + (@eval;eval sampleI)) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) + (n.= (<reference> param subject) + (:! Nat valueG)) + + (#e;Error error) + false)))] + + [(format "jvm " <domain> " and") bit;and] + [(format "jvm " <domain> " or") bit;or] + [(format "jvm " <domain> " xor") bit;xor] + )) + )))))] + + ["int" "jvm convert int-to-long" "jvm convert long-to-int"] + ["long" "lux noop" "lux noop"] ) (do-template [<domain> <post> <convert>] - [(context: (format "Bit-wise [" <domain> "]") + [(context: (format "Bit-wise [" <domain> "] { Shifters }") (<| (times +100) (do @ [param gen-nat subject gen-nat #let [shift (n.% +10 param)]] - (with-expansions [<combiners> (do-template [<procedure> <reference>] - [(test <procedure> - (|> (do meta;Monad<Meta> - [sampleI (@;generate (<post> (#ls;Procedure <procedure> (list (<convert> (#ls;Nat subject)) - (<convert> (#ls;Nat param))))))] - (@eval;eval sampleI)) - (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (n.= (<reference> param subject) - (:! Nat valueG)) - - (#e;Error error) - false)))] - - [(format "jvm " <domain> " and") bit;and] - [(format "jvm " <domain> " or") bit;or] - [(format "jvm " <domain> " xor") bit;xor] - ) - <shifters> (do-template [<procedure> <reference> <type> <test> <pre-subject> <pre>] - [(test <procedure> - (|> (do meta;Monad<Meta> - [sampleI (@;generate (<post> (#ls;Procedure <procedure> (list (<convert> (<pre> subject)) - (|> (#ls;Nat shift) - (list) - (#ls;Procedure "jvm convert long-to-int"))))))] - (@eval;eval sampleI)) - (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> (<reference> shift (<pre-subject> subject)) - (:! <type> valueG)) - - (#e;Error error) - false)))] - - [(format "jvm " <domain> " shl") bit;shift-left Nat n.= id #ls;Nat] - [(format "jvm " <domain> " shr") bit;signed-shift-right Int i.= nat-to-int (|>. nat-to-int #ls;Int)] - [(format "jvm " <domain> " ushr") bit;shift-right Nat n.= id #ls;Nat] - )] - ($_ seq - <combiners> - <shifters> - )))))] - - ["int" (|>. (list) (#ls;Procedure "jvm convert int-to-long")) (|>. (list) (#ls;Procedure "jvm convert long-to-int"))] - ["long" id id] + (`` ($_ seq + (~~ (do-template [<procedure> <reference> <type> <test> <pre-subject> <pre>] + [(test <procedure> + (|> (do meta;Monad<Meta> + [sampleI (@;generate (` (<post> ((~ (code;text <procedure>)) + (<convert> (~ (<pre> subject))) + ("jvm convert long-to-int" (~ (code;nat shift)))))))] + (@eval;eval sampleI)) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) + (<test> (<reference> shift (<pre-subject> subject)) + (:! <type> valueG)) + + (#e;Error error) + false)))] + + [(format "jvm " <domain> " shl") bit;shift-left Nat n.= id code;nat] + [(format "jvm " <domain> " shr") bit;signed-shift-right Int i.= nat-to-int (|>. nat-to-int code;int)] + [(format "jvm " <domain> " ushr") bit;shift-right Nat n.= id code;nat] + )) + )))))] + + ["int" "jvm convert int-to-long" "jvm convert long-to-int"] + ["long" "lux noop" "lux noop"] ) (do-template [<domain> <generator> <tag> <=> <<> <pre>] @@ -222,8 +231,9 @@ (with-expansions [<tests> (do-template [<procedure> <reference>] [(test <procedure> (|> (do meta;Monad<Meta> - [sampleI (@;generate (#ls;Procedure <procedure> (list (<pre> (<tag> subject)) - (<pre> (<tag> param)))))] + [sampleI (@;generate (` ((~ (code;text <procedure>)) + (<pre> (~ (<tag> subject))) + (<pre> (~ (<tag> param))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success valueG) @@ -240,14 +250,25 @@ <tests> )))))] - ["int" gen-int #ls;Int i.= i.< (|>. (list) (#ls;Procedure "jvm convert long-to-int"))] - ["long" gen-int #ls;Int i.= i.< id] - ["float" gen-frac #ls;Frac f.= f.< (|>. (list) (#ls;Procedure "jvm convert double-to-float"))] - ["double" gen-frac #ls;Frac f.= f.< id] - ["char" gen-int #ls;Int i.= i.< (|>. (list) (#ls;Procedure "jvm convert long-to-int") - (list) (#ls;Procedure "jvm convert int-to-char"))] + ["int" gen-int code;int i.= i.< "jvm convert long-to-int"] + ["long" gen-int code;int i.= i.< "lux noop"] + ["float" gen-frac code;frac f.= f.< "jvm convert double-to-float"] + ["double" gen-frac code;frac f.= f.< "lux noop"] + ["char" gen-int code;int i.= i.< "jvm convert long-to-char"] ) +(def: (jvm//array//new dimension class size) + (-> Nat Text Nat ls;Synthesis) + (` ("jvm array new" (~ (code;nat dimension)) (~ (code;text class)) (~ (code;nat size))))) + +(def: (jvm//array//write class idx inputS arrayS) + (-> Text Nat ls;Synthesis ls;Synthesis ls;Synthesis) + (` ("jvm array write" (~ (code;text class)) (~ (code;nat idx)) (~ inputS) (~ arrayS)))) + +(def: (jvm//array//read class idx arrayS) + (-> Text Nat ls;Synthesis ls;Synthesis) + (` ("jvm array read" (~ (code;text class)) (~ (code;nat idx)) (~ arrayS)))) + (context: "Array [Part 1]" (<| (times +100) (do @ @@ -264,10 +285,12 @@ (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text <class>) (#ls;Nat size))) - (list (#ls;Text <class>) (#ls;Nat idx) <input>) (#ls;Procedure "jvm array write") - (list (#ls;Text <class>) (#ls;Nat idx)) (#ls;Procedure "jvm array read") - <post>))] + [sampleI (@;generate (|> (jvm//array//new +0 <class> size) + (jvm//array//write <class> idx <input>) + (jvm//array//read <class> idx) + (~) + <post> + (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputZ) @@ -276,21 +299,20 @@ (#e;Error error) false)))] - ["boolean" Bool valueZ bool/= (#ls;Bool valueZ) id] - ["byte" Int valueB i.= (|> (#ls;Int valueB) - (list) (#ls;Procedure "jvm convert long-to-byte")) - (<| (#ls;Procedure "jvm convert byte-to-long") (list))] - ["short" Int valueS i.= (|> (#ls;Int valueS) - (list) (#ls;Procedure "jvm convert long-to-short")) - (<| (#ls;Procedure "jvm convert short-to-long") (list))] - ["int" Int valueI i.= (|> (#ls;Int valueI) - (list) (#ls;Procedure "jvm convert long-to-int")) - (<| (#ls;Procedure "jvm convert int-to-long") (list))] - ["long" Int valueL i.= (#ls;Int valueL) id] - ["float" Frac valueF f.= (|> (#ls;Frac valueF) - (list) (#ls;Procedure "jvm convert double-to-float")) - (<| (#ls;Procedure "jvm convert float-to-double") (list))] - ["double" Frac valueD f.= (#ls;Frac valueD) id] + ["boolean" Bool valueZ bool/= (code;bool valueZ) + "lux noop"] + ["byte" Int valueB i.= (|> (code;int valueB) (~) "jvm convert long-to-byte" (`)) + "jvm convert byte-to-long"] + ["short" Int valueS i.= (|> (code;int valueS) (~) "jvm convert long-to-short" (`)) + "jvm convert short-to-long"] + ["int" Int valueI i.= (|> (code;int valueI) (~) "jvm convert long-to-int" (`)) + "jvm convert int-to-long"] + ["long" Int valueL i.= (code;int valueL) + "lux noop"] + ["float" Frac valueF f.= (|> (code;frac valueF) (~) "jvm convert double-to-float" (`)) + "jvm convert float-to-double"] + ["double" Frac valueD f.= (code;frac valueD) + "lux noop"] )] ($_ seq <array> @@ -312,10 +334,12 @@ (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text <class>) (#ls;Nat size))) - (list (#ls;Text <class>) (#ls;Nat idx) <input>) (#ls;Procedure "jvm array write") - (list (#ls;Text <class>) (#ls;Nat idx)) (#ls;Procedure "jvm array read") - <post>))] + [sampleI (@;generate (|> (jvm//array//new +0 <class> size) + (jvm//array//write <class> idx <input>) + (jvm//array//read <class> idx) + (~) + <post> + (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -324,22 +348,25 @@ (#e;Error error) false)))] - ["char" Int valueC i.= (|> (#ls;Int valueC) - (list) (#ls;Procedure "jvm convert long-to-int") - (list) (#ls;Procedure "jvm convert int-to-char")) - (<| (#ls;Procedure "jvm convert char-to-long") (list))] - ["java.lang.Long" Int valueL i.= (#ls;Int valueL) id] + ["char" Int valueC i.= + (|> (code;int valueC) (~) "jvm convert long-to-int" "jvm convert int-to-char" (`)) + "jvm convert char-to-long"] + ["java.lang.Long" Int valueL i.= + (code;int valueL) + "lux noop"] )] ($_ seq <array> (test "java.lang.Double (level 1)" (|> (do meta;Monad<Meta> - [#let [inner (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text "java.lang.Double") (#ls;Nat size))) - (list (#ls;Text "java.lang.Double") (#ls;Nat idx) (#ls;Frac valueD)) (#ls;Procedure "jvm array write"))] - sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +1) (#ls;Text "java.lang.Double") (#ls;Nat size))) - (list (#ls;Text "#Array") (#ls;Nat idx) inner) (#ls;Procedure "jvm array write") - (list (#ls;Text "#Array") (#ls;Nat idx)) (#ls;Procedure "jvm array read") - (list (#ls;Text "java.lang.Double") (#ls;Nat idx)) (#ls;Procedure "jvm array read")))] + [#let [inner (|> ("jvm array new" +0 "java.lang.Double" (~ (code;nat size))) + ("jvm array write" "java.lang.Double" (~ (code;nat idx)) (~ (code;frac valueD))) + (`))] + sampleI (@;generate (|> ("jvm array new" +1 "java.lang.Double" (~ (code;nat size))) + ("jvm array write" "#Array" (~ (code;nat idx)) (~ inner)) + ("jvm array read" "#Array" (~ (code;nat idx))) + ("jvm array read" "java.lang.Double" (~ (code;nat idx))) + (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -349,8 +376,7 @@ false))) (test "jvm array length" (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text "java.lang.Object") (#ls;Nat size))) - (list) (#ls;Procedure "jvm array length")))] + [sampleI (@;generate (` ("jvm array length" ("jvm array new" +0 "java.lang.Object" (~ (code;nat size))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -370,10 +396,10 @@ (def: instances (List [Text (r;Random ls;Synthesis)]) - (let [gen-boolean (|> r;bool (:: r;Functor<Random> map (|>. #ls;Bool))) - gen-integer (|> r;int (:: r;Functor<Random> map (|>. #ls;Int))) - gen-double (|> r;frac (:: r;Functor<Random> map (|>. #ls;Frac))) - gen-string (|> (r;text +5) (:: r;Functor<Random> map (|>. #ls;Text)))] + (let [gen-boolean (|> r;bool (:: r;Functor<Random> map code;bool)) + 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))] (list ["java.lang.Boolean" gen-boolean] ["java.lang.Long" gen-integer] ["java.lang.Double" gen-double] @@ -393,16 +419,14 @@ exception-message (r;text +5) #let [class (maybe;assume (list;nth class-idx classes)) [instance-class instance-gen] (maybe;assume (list;nth instance-idx instances)) - exception-message$ (|> (#ls;Text exception-message) - (list (#ls;Text "java.lang.String")) #ls;Tuple)] + exception-message$ (` ["java.lang.String" (~ (code;text exception-message))])] sample r;int monitor r;int instance instance-gen] ($_ seq (test "jvm object null" (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (#ls;Procedure "jvm object null" (list)) - (list) (#ls;Procedure "jvm object null?")))] + [sampleI (@;generate (` ("jvm object null?" ("jvm object null"))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -412,8 +436,7 @@ false))) (test "jvm object null?" (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (#ls;Int sample) - (list) (#ls;Procedure "jvm object null?")))] + [sampleI (@;generate (` ("jvm object null?" (~ (code;int sample)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -423,9 +446,7 @@ false))) (test "jvm object synchronized" (|> (do meta;Monad<Meta> - [sampleI (@;generate (#ls;Procedure "jvm object synchronized" - (list (#ls;Int monitor) - (#ls;Int sample))))] + [sampleI (@;generate (` ("jvm object synchronized" (~ (code;int monitor)) (~ (code;int sample)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -436,11 +457,10 @@ (test "jvm object throw" (|> (do meta;Monad<Meta> [_ @runtime;generate - sampleI (@;generate (|> (#ls;Procedure "jvm member invoke constructor" (list (#ls;Text "java.lang.Throwable") - exception-message$)) - (list) (#ls;Procedure "jvm object throw") - (#ls;Function +1 (list)) - (list) (#ls;Procedure "lux try")))] + sampleI (@;generate (` ("lux try" ("lux function" +1 [] + ("jvm object throw" ("jvm member invoke constructor" + "java.lang.Throwable" + (~ exception-message$)))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -455,7 +475,7 @@ false))) (test "jvm object class" (|> (do meta;Monad<Meta> - [sampleI (@;generate (#ls;Procedure "jvm object class" (list (#ls;Text class))))] + [sampleI (@;generate (` ("jvm object class" (~ (code;text class)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -465,8 +485,7 @@ false))) (test "jvm object instance?" (|> (do meta;Monad<Meta> - [sampleI (@;generate (#ls;Procedure "jvm object instance?" (list (#ls;Text instance-class) - instance)))] + [sampleI (@;generate (` ("jvm object instance?" (~ (code;text instance-class)) (~ instance))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -485,28 +504,18 @@ [sample-short (|> r;int (:: @ map (|>. int/abs (i.% 100)))) sample-string (r;text +5) other-sample-string (r;text +5) - #let [shortS (|> (#ls;Int sample-short) - (list) (#ls;Procedure "jvm convert long-to-short") - (list (#ls;Text "short")) #ls;Tuple) - stringS (|> (#ls;Text sample-string) - (list (#ls;Text "java.lang.String")) #ls;Tuple) - type-codeS (|> (#ls;Procedure "jvm object null" (list)) - (list (#ls;Text "org.omg.CORBA.TypeCode")) #ls;Tuple) - idl-typeS (|> (#ls;Procedure "jvm object null" (list)) - (list (#ls;Text "org.omg.CORBA.IDLType")) #ls;Tuple) - value-member$ (#ls;Procedure "jvm member invoke constructor" (list (#ls;Text "org.omg.CORBA.ValueMember") - stringS - stringS - stringS - stringS - type-codeS - idl-typeS - shortS))]] + #let [shortS (` ["short" ("jvm convert long-to-short" (~ (code;int sample-short)))]) + stringS (` ["java.lang.String" (~ (code;text sample-string))]) + type-codeS (` ["org.omg.CORBA.TypeCode" ("jvm object null")]) + idl-typeS (` ["org.omg.CORBA.IDLType" ("jvm object null")]) + value-memberS (` ("jvm member invoke constructor" + "org.omg.CORBA.ValueMember" + (~ stringS) (~ stringS) (~ stringS) (~ stringS) + (~ type-codeS) (~ idl-typeS) (~ shortS)))]] ($_ seq (test "jvm member static get" (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> (#ls;Procedure "jvm member static get" (list (#ls;Text "java.util.GregorianCalendar") (#ls;Text "AD") (#ls;Text "int"))) - (list) (#ls;Procedure "jvm convert int-to-long")))] + [sampleI (@;generate (` ("jvm convert int-to-long" ("jvm member static get" "java.util.GregorianCalendar" "AD" "int"))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -516,8 +525,8 @@ false))) (test "jvm member static put" (|> (do meta;Monad<Meta> - [sampleI (@;generate (#ls;Procedure "jvm member static put" (list (#ls;Text "java.awt.datatransfer.DataFlavor") (#ls;Text "allHtmlFlavor") (#ls;Text "java.awt.datatransfer.DataFlavor") - (#ls;Procedure "jvm member static get" (list (#ls;Text "java.awt.datatransfer.DataFlavor") (#ls;Text "allHtmlFlavor") (#ls;Text "java.awt.datatransfer.DataFlavor"))))))] + [sampleI (@;generate (` ("jvm member static put" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor" + ("jvm member static get" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor"))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -527,11 +536,7 @@ false))) (test "jvm member virtual get" (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> value-member$ - (list (#ls;Text "org.omg.CORBA.ValueMember") - (#ls;Text "name") - (#ls;Text "java.lang.String")) - (#ls;Procedure "jvm member virtual get")))] + [sampleI (@;generate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" (~ value-memberS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -541,16 +546,9 @@ false))) (test "jvm member virtual put" (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> value-member$ - (list (#ls;Text "org.omg.CORBA.ValueMember") - (#ls;Text "name") - (#ls;Text "java.lang.String") - (#ls;Text other-sample-string)) - (#ls;Procedure "jvm member virtual put") - (list (#ls;Text "org.omg.CORBA.ValueMember") - (#ls;Text "name") - (#ls;Text "java.lang.String")) - (#ls;Procedure "jvm member virtual get")))] + [sampleI (@;generate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" + ("jvm member virtual put" "org.omg.CORBA.ValueMember" "name" "java.lang.String" + (~ (code;text other-sample-string)) (~ value-memberS)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -568,22 +566,14 @@ (<| (times +100) (do @ [sample (|> r;int (:: @ map (|>. int/abs (i.% 100)))) - #let [object-longS (|> (#ls;Int sample) - (list (#ls;Text "java.lang.Object")) #ls;Tuple) - intS (|> (#ls;Int sample) - (list) (#ls;Procedure "jvm convert long-to-int") - (list (#ls;Text "int")) #ls;Tuple) - coded-intS (|> (#ls;Text (int/encode sample)) - (list (#ls;Text "java.lang.String")) #ls;Tuple) - array-listS (#ls;Procedure "jvm member invoke constructor" (list (#ls;Text "java.util.ArrayList") intS))]] + #let [object-longS (` ["java.lang.Object" (~ (code;int sample))]) + intS (` ["int" ("jvm convert long-to-int" (~ (code;int sample)))]) + coded-intS (` ["java.lang.String" (~ (code;text (int/encode sample)))]) + array-listS (` ("jvm member invoke constructor" "java.util.ArrayList" (~ intS)))]] ($_ seq (test "jvm member invoke static" (|> (do meta;Monad<Meta> - [sampleI (@;generate (#ls;Procedure "jvm member invoke static" - (list (#ls;Text "java.lang.Long") - (#ls;Text "decode") - (#ls;Text "java.lang.Long") - coded-intS)))] + [sampleI (@;generate (` ("jvm member invoke static" "java.lang.Long" "decode" "java.lang.Long" (~ coded-intS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -593,12 +583,8 @@ false))) (test "jvm member invoke virtual" (|> (do meta;Monad<Meta> - [sampleI (@;generate (|> object-longS - (list (#ls;Text "java.lang.Object") - (#ls;Text "equals") - (#ls;Text "boolean") - (#ls;Int sample)) - (#ls;Procedure "jvm member invoke virtual")))] + [sampleI (@;generate (` ("jvm member invoke virtual" "java.lang.Object" "equals" "boolean" + (~ (code;int sample)) (~ object-longS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) @@ -608,12 +594,8 @@ false))) (test "jvm member invoke interface" (|> (do meta;Monad<Meta> - [sampleI (@;generate (#ls;Procedure "jvm member invoke interface" - (list (#ls;Text "java.util.Collection") - (#ls;Text "add") - (#ls;Text "boolean") - array-listS - object-longS)))] + [sampleI (@;generate (` ("jvm member invoke interface" "java.util.Collection" "add" "boolean" + (~ array-listS) (~ object-longS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) (case> (#e;Success outputG) |