Search in sources :

Example 1 with NullValue

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

the class TypedExportTest method testInvalidArrayWrite.

@Test(expected = UnsupportedOperationException.class)
public void testInvalidArrayWrite() {
    Value nested = allocNested.execute();
    try {
        Value pointArray = nested.getMember("pointArray");
        pointArray.setArrayElement(2, new NullValue());
    } finally {
        freeNested.execute(nested);
    }
}
Also used : NullValue(com.oracle.truffle.llvm.test.interop.values.NullValue) Value(org.graalvm.polyglot.Value) NullValue(com.oracle.truffle.llvm.test.interop.values.NullValue) Test(org.junit.Test)

Example 2 with NullValue

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

the class TypedInteropTest method createNested.

private static Object createNested() {
    Object ret = new NullValue();
    for (int i = 0; i < 10; i++) {
        Map<String, Object> nested = new HashMap<>();
        nested.put("arr", new ArrayObject(makePoint(0, 0), makePoint(0, 0), makePoint(0, 0), makePoint(0, 0), makePoint(0, 0)));
        nested.put("direct", makePoint(0, 0));
        nested.put("next", ret);
        ret = new StructObject(nested);
    }
    return ret;
}
Also used : ArrayObject(com.oracle.truffle.llvm.test.interop.values.ArrayObject) NullValue(com.oracle.truffle.llvm.test.interop.values.NullValue) HashMap(java.util.HashMap) StructObject(com.oracle.truffle.llvm.test.interop.values.StructObject) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) StructObject(com.oracle.truffle.llvm.test.interop.values.StructObject) ArrayObject(com.oracle.truffle.llvm.test.interop.values.ArrayObject)

Aggregations

NullValue (com.oracle.truffle.llvm.test.interop.values.NullValue)2 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)1 ArrayObject (com.oracle.truffle.llvm.test.interop.values.ArrayObject)1 StructObject (com.oracle.truffle.llvm.test.interop.values.StructObject)1 HashMap (java.util.HashMap)1 Value (org.graalvm.polyglot.Value)1 Test (org.junit.Test)1