Search in sources :

Example 1 with NullObject

use of com.oracle.truffle.nfi.test.interop.NullObject in project graal by oracle.

the class NullArrayNFITest method testNullArray.

@Test
public void testNullArray(@Inject(NullArrayNode.class) CallTarget target) {
    Object ret = target.call(new NullObject());
    Assert.assertThat("return value", ret, is(instanceOf(TruffleObject.class)));
    TruffleObject obj = (TruffleObject) ret;
    Assert.assertTrue("isBoxed", isBoxed(obj));
    Assert.assertEquals("return value", "null", unbox(obj));
}
Also used : TruffleObject(com.oracle.truffle.api.interop.TruffleObject) NullObject(com.oracle.truffle.nfi.test.interop.NullObject) NullObject(com.oracle.truffle.nfi.test.interop.NullObject) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) Test(org.junit.Test)

Example 2 with NullObject

use of com.oracle.truffle.nfi.test.interop.NullObject in project graal by oracle.

the class NullNFITest method testNullArg.

@Test
public void testNullArg(@Inject(TestNullArgNode.class) CallTarget callTarget) {
    String expected = getExpected();
    Object ret = callTarget.call(new NullObject());
    Assert.assertThat("return value", ret, is(instanceOf(TruffleObject.class)));
    TruffleObject obj = (TruffleObject) ret;
    Assert.assertTrue("isBoxed", isBoxed(obj));
    Assert.assertEquals("return value", expected, unbox(obj));
}
Also used : TruffleObject(com.oracle.truffle.api.interop.TruffleObject) NullObject(com.oracle.truffle.nfi.test.interop.NullObject) NullObject(com.oracle.truffle.nfi.test.interop.NullObject) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) Test(org.junit.Test)

Example 3 with NullObject

use of com.oracle.truffle.nfi.test.interop.NullObject in project graal by oracle.

the class NullNFITest method testNullCallbackRet.

@Test
public void testNullCallbackRet(@Inject(TestNullCallbackRetNode.class) CallTarget callTarget) {
    String expected = getExpected();
    TruffleObject nullCallback = new TestCallback(0, (args) -> {
        return new NullObject();
    });
    Object ret = callTarget.call(nullCallback);
    Assert.assertThat("return value", ret, is(instanceOf(TruffleObject.class)));
    TruffleObject obj = (TruffleObject) ret;
    Assert.assertTrue("isBoxed", isBoxed(obj));
    Assert.assertEquals("return value", expected, unbox(obj));
}
Also used : NullObject(com.oracle.truffle.nfi.test.interop.NullObject) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) NullObject(com.oracle.truffle.nfi.test.interop.NullObject) TestCallback(com.oracle.truffle.nfi.test.interop.TestCallback) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) Test(org.junit.Test)

Aggregations

TruffleObject (com.oracle.truffle.api.interop.TruffleObject)3 NullObject (com.oracle.truffle.nfi.test.interop.NullObject)3 Test (org.junit.Test)3 TestCallback (com.oracle.truffle.nfi.test.interop.TestCallback)1