aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/test/test
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/test/test')
-rw-r--r--new-luxc/test/test/luxc/generator/procedure/host.jvm.lux73
1 files changed, 72 insertions, 1 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 0cfd47538..ba90a00e3 100644
--- a/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux
+++ b/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux
@@ -7,7 +7,7 @@
["e" error]
[bit]
[bool "bool/" Eq<Bool>]
- [number "int/" Number<Int>]
+ [number "int/" Number<Int> Codec<Text,Int>]
[text "text/" Eq<Text>]
text/format
(coll [list]))
@@ -470,3 +470,74 @@
(test "jvm member virtual put"
false)
))
+
+(host;import java.lang.Object)
+
+(host;import (java.util.ArrayList a))
+
+(context: "Member [Method]"
+ [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))]]
+ ($_ 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)))]
+ (@eval;eval sampleI))
+ (meta;run (init-compiler []))
+ (case> (#e;Success outputG)
+ (i.= sample (:! Int outputG))
+
+ (#e;Error error)
+ 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")))]
+ (@eval;eval sampleI))
+ (meta;run (init-compiler []))
+ (case> (#e;Success outputG)
+ (:! Bool outputG)
+
+ (#e;Error error)
+ 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)))]
+ (@eval;eval sampleI))
+ (meta;run (init-compiler []))
+ (case> (#e;Success outputG)
+ (:! Bool outputG)
+
+ (#e;Error error)
+ false)))
+ (test "jvm member invoke constructor"
+ (|> (do meta;Monad<Meta>
+ [sampleI (@;generate array-listS)]
+ (@eval;eval sampleI))
+ (meta;run (init-compiler []))
+ (case> (#e;Success outputG)
+ (host;instance? ArrayList (:! Object outputG))
+
+ (#e;Error error)
+ false)))
+ ))