Search in sources :

Example 1 with BoxedTestValue

use of com.oracle.truffle.llvm.test.interop.values.BoxedTestValue in project sulong by graalvm.

the class LLVMInteropTest method test013.

@Test
public void test013() {
    try (Runner runner = new Runner("interop013")) {
        runner.export(new BoxedTestValue(42), "foreign");
        Assert.assertEquals(42, runner.run());
    }
}
Also used : BoxedTestValue(com.oracle.truffle.llvm.test.interop.values.BoxedTestValue) Test(org.junit.Test)

Example 2 with BoxedTestValue

use of com.oracle.truffle.llvm.test.interop.values.BoxedTestValue in project sulong by graalvm.

the class LLVMInteropTest method test014.

@Test
public void test014() {
    try (Runner runner = new Runner("interop014")) {
        runner.export(new BoxedTestValue(42), "foreign");
        Assert.assertEquals(42, runner.run(), 0.1);
    }
}
Also used : BoxedTestValue(com.oracle.truffle.llvm.test.interop.values.BoxedTestValue) Test(org.junit.Test)

Example 3 with BoxedTestValue

use of com.oracle.truffle.llvm.test.interop.values.BoxedTestValue in project sulong by graalvm.

the class PolyglotScopeTest method testImportBoxed.

@Test
public void testImportBoxed(@Inject(TestImportVarNode.class) CallTarget testImport) {
    String value = "testImportBoxedValue";
    runWithPolyglot.getPolyglotContext().getPolyglotBindings().putMember("boxedName", value);
    Object ret = testImport.call(new BoxedTestValue("boxedName"));
    Assert.assertEquals(value, ret);
}
Also used : BoxedTestValue(com.oracle.truffle.llvm.test.interop.values.BoxedTestValue) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) Test(org.junit.Test)

Example 4 with BoxedTestValue

use of com.oracle.truffle.llvm.test.interop.values.BoxedTestValue in project sulong by graalvm.

the class StringTest method testAsStringBoxed.

@Test
public void testAsStringBoxed(@Inject(TestAsStringAsciiNode.class) CallTarget asString) {
    Object ret = asString.call(new BoxedTestValue(ASCII_STRING));
    Assert.assertEquals(ASCII_LENGTH, ret);
}
Also used : BoxedTestValue(com.oracle.truffle.llvm.test.interop.values.BoxedTestValue) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) Test(org.junit.Test)

Example 5 with BoxedTestValue

use of com.oracle.truffle.llvm.test.interop.values.BoxedTestValue in project sulong by graalvm.

the class StringTest method testStringSizeBoxed.

@Test
public void testStringSizeBoxed(@Inject(TestStringSizeNode.class) CallTarget getSize) {
    Object ret = getSize.call(new BoxedTestValue(ASCII_STRING));
    Assert.assertEquals((long) ASCII_STRING.length(), ret);
}
Also used : BoxedTestValue(com.oracle.truffle.llvm.test.interop.values.BoxedTestValue) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) Test(org.junit.Test)

Aggregations

BoxedTestValue (com.oracle.truffle.llvm.test.interop.values.BoxedTestValue)6 Test (org.junit.Test)5 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Value (org.graalvm.polyglot.Value)1 ProxyExecutable (org.graalvm.polyglot.proxy.ProxyExecutable)1 ProxyObject (org.graalvm.polyglot.proxy.ProxyObject)1 Parameters (org.junit.runners.Parameterized.Parameters)1