use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class AsCollectionsTest method testInvokeArrayOfMap.
@Test
public void testInvokeArrayOfMap() throws InteropException {
TruffleObject validator = com.oracle.truffle.api.interop.java.JavaInterop.asTruffleObject(new Validator());
MapBasedTO mapTO = new MapBasedTO(Collections.singletonMap("foo", "bar"));
TruffleObject listOfMapTO = new ListBasedTO(Arrays.asList(mapTO));
assertEquals(Boolean.TRUE, ForeignAccess.sendInvoke(Message.createInvoke(1).createNode(), validator, "validateArrayOfMap", listOfMapTO, listOfMapTO));
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class CallbackConvertTest method callWithNegativeNumberTest.
@Test(expected = IllegalArgumentException.class)
public void callWithNegativeNumberTest() {
TruffleObject truffle = JavaInterop.asTruffleObject(this);
CallWithInt callback = JavaInterop.asJavaObject(CallWithInt.class, truffle);
callback.callback(-32);
assertEquals("The call will not get here", 0, ch);
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class CallbackConvertTest method callWithHugeIntTest.
@Test(expected = IllegalArgumentException.class)
public void callWithHugeIntTest() {
TruffleObject truffle = JavaInterop.asTruffleObject(this);
CallWithInt callback = JavaInterop.asJavaObject(CallWithInt.class, truffle);
callback.callback(Integer.MAX_VALUE / 2);
fail("Should thrown an exception as the int value is too big for char: " + ch);
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class CallbackConvertTest method callWithIntTest.
@Test
public void callWithIntTest() {
TruffleObject truffle = JavaInterop.asTruffleObject(this);
CallWithInt callback = JavaInterop.asJavaObject(CallWithInt.class, truffle);
callback.callback(32);
assertEquals(' ', ch);
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class CallbackConvertTest method callWithCharTest.
@Test
public void callWithCharTest() {
TruffleObject truffle = JavaInterop.asTruffleObject(this);
CallWithChar callback = JavaInterop.asJavaObject(CallWithChar.class, truffle);
callback.callback('A');
assertEquals('A', ch);
}
Aggregations