Skip to content
Snippets Groups Projects
Commit a6c4e477 authored by Lukas Stadler's avatar Lukas Stadler Committed by stepan
Browse files

change assumptions in tests about IS_POINTER and TO_NATIVE messages

parent 17a51c69
No related branches found
No related tags found
No related merge requests found
......@@ -22,25 +22,24 @@
*/
package com.oracle.truffle.r.test.engine.interop;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.interop.InteropException;
import com.oracle.truffle.api.interop.Message;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.vm.PolyglotEngine;
import com.oracle.truffle.r.ffi.impl.interop.NativePointer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.interop.InteropException;
import com.oracle.truffle.api.interop.Message;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.vm.PolyglotEngine;
public abstract class AbstractMRTest {
protected static PolyglotEngine engine;
......@@ -117,7 +116,7 @@ public abstract class AbstractMRTest {
@Test
public void testIsPointer() throws Exception {
for (TruffleObject obj : createTruffleObjects()) {
assertEquals(isPointer(obj), ForeignAccess.sendIsPointer(Message.IS_POINTER.createNode(), obj));
assertEquals(obj.getClass().getSimpleName(), isPointer(obj), ForeignAccess.sendIsPointer(Message.IS_POINTER.createNode(), obj));
}
}
......@@ -125,7 +124,7 @@ public abstract class AbstractMRTest {
public void testNativePointer() throws Exception {
for (TruffleObject obj : createTruffleObjects()) {
try {
assertTrue(ForeignAccess.sendToNative(Message.TO_NATIVE.createNode(), obj) instanceof NativePointer);
assertTrue(obj.getClass().getSimpleName(), ForeignAccess.sendToNative(Message.TO_NATIVE.createNode(), obj) == obj);
} catch (UnsupportedMessageException unsupportedMessageException) {
}
}
......
......@@ -38,7 +38,6 @@ import com.oracle.truffle.api.interop.UnsupportedTypeException;
import com.oracle.truffle.api.interop.java.JavaInterop;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.vm.PolyglotEngine;
import com.oracle.truffle.r.ffi.impl.interop.NativePointer;
import com.oracle.truffle.r.runtime.data.RList;
import com.oracle.truffle.r.runtime.data.RNull;
import com.oracle.truffle.r.runtime.data.RPairList;
......@@ -51,8 +50,9 @@ public class ListMRTest extends AbstractMRTest {
@Override
@Test
public void testNativePointer() throws UnsupportedMessageException, UnknownIdentifierException, UnsupportedTypeException {
assertTrue(ForeignAccess.sendToNative(Message.TO_NATIVE.createNode(), create("list", testValues)) instanceof NativePointer);
assertTrue(ForeignAccess.sendToNative(Message.TO_NATIVE.createNode(), create("pairlist", testValues)) instanceof NativePointer);
for (TruffleObject obj : new TruffleObject[]{create("list", testValues), create("pairlist", testValues)}) {
assertTrue(ForeignAccess.sendToNative(Message.TO_NATIVE.createNode(), obj) == obj);
}
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment