use of org.graalvm.polyglot.proxy.ProxyExecutable in project sulong by graalvm.
the class LLVMInteropTest method test015.
@Test
public void test015() {
try (Runner runner = new Runner("interop015")) {
runner.export(new ProxyExecutable() {
@Override
public Object execute(Value... t) {
Assert.assertEquals("argument count", 2, t.length);
return t[0].asDouble() + t[1].asDouble();
}
}, "foreign");
Assert.assertEquals(42, runner.run(), 0.1);
}
}
use of org.graalvm.polyglot.proxy.ProxyExecutable in project sulong by graalvm.
the class TypeCheckTest method data.
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
ArrayList<Object[]> tests = new ArrayList<>();
tests.add(new Object[] { "boolean", true });
tests.add(new Object[] { "byte", (byte) 5 });
tests.add(new Object[] { "short", (short) 5 });
tests.add(new Object[] { "int", 5 });
tests.add(new Object[] { "boxedint", new BoxedTestValue(42) });
tests.add(new Object[] { "long", 5L });
tests.add(new Object[] { "big_long", Long.MAX_VALUE });
tests.add(new Object[] { "float", 5.7f });
tests.add(new Object[] { "small_float", Float.MIN_VALUE });
tests.add(new Object[] { "big_float", Float.MAX_VALUE });
tests.add(new Object[] { "double", 5.7 });
tests.add(new Object[] { "small_double", Double.MIN_VALUE });
tests.add(new Object[] { "big_double", Double.MAX_VALUE });
tests.add(new Object[] { "string", "Hello, World!" });
tests.add(new Object[] { "null", null });
tests.add(new Object[] { "object", ProxyObject.fromMap(new HashMap<>()) });
tests.add(new Object[] { "array", ProxyArray.fromArray() });
tests.add(new Object[] { "executable", new ProxyExecutable() {
@Override
public Object execute(Value... arguments) {
return null;
}
} });
return tests;
}
Aggregations