Search in sources :

Example 1 with ArrayTruffleObject

use of com.oracle.truffle.api.test.polyglot.ValueHostInteropTest.ArrayTruffleObject in project graal by oracle.

the class LanguageSPIHostInteropTest method keyInfo.

@Test
public void keyInfo() {
    TruffleObject ipobj = new InternalPropertiesObject(-1, -1, 0, 0);
    int keyInfo = getKeyInfo(ipobj, "p1");
    assertTrue(KeyInfo.isReadable(keyInfo));
    assertTrue(KeyInfo.isWritable(keyInfo));
    assertFalse(KeyInfo.isInvocable(keyInfo));
    assertFalse(KeyInfo.isInternal(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p6");
    assertTrue(KeyInfo.isReadable(keyInfo));
    assertTrue(KeyInfo.isWritable(keyInfo));
    assertFalse(KeyInfo.isInvocable(keyInfo));
    assertFalse(KeyInfo.isInternal(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p7");
    assertEquals(0, keyInfo);
    ipobj = new InternalPropertiesObject(0b0100010, 0b0100100, 0b0011000, 0);
    keyInfo = getKeyInfo(ipobj, "p1");
    assertTrue(KeyInfo.isReadable(keyInfo));
    assertFalse(KeyInfo.isWritable(keyInfo));
    assertFalse(KeyInfo.isInvocable(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p2");
    assertFalse(KeyInfo.isReadable(keyInfo));
    assertTrue(KeyInfo.isWritable(keyInfo));
    assertFalse(KeyInfo.isInvocable(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p3");
    assertFalse(KeyInfo.isReadable(keyInfo));
    assertFalse(KeyInfo.isWritable(keyInfo));
    assertTrue(KeyInfo.isInvocable(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p4");
    assertFalse(KeyInfo.isReadable(keyInfo));
    assertFalse(KeyInfo.isWritable(keyInfo));
    assertTrue(KeyInfo.isInvocable(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p5");
    assertTrue(KeyInfo.isReadable(keyInfo));
    assertTrue(KeyInfo.isWritable(keyInfo));
    assertFalse(KeyInfo.isInvocable(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p6");
    assertFalse(KeyInfo.isReadable(keyInfo));
    assertFalse(KeyInfo.isWritable(keyInfo));
    assertFalse(KeyInfo.isInvocable(keyInfo));
    keyInfo = getKeyInfo(ipobj, "p7");
    assertEquals(0, keyInfo);
    TruffleObject aobj = new ArrayTruffleObject(100);
    testArrayObject(aobj, 100);
    aobj = (TruffleObject) env.asGuestValue(new String[] { "A", "B", "C", "D" });
    testArrayObject(aobj, 4);
}
Also used : ArrayTruffleObject(com.oracle.truffle.api.test.polyglot.ValueHostInteropTest.ArrayTruffleObject) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) ArrayTruffleObject(com.oracle.truffle.api.test.polyglot.ValueHostInteropTest.ArrayTruffleObject) Test(org.junit.Test)

Aggregations

TruffleObject (com.oracle.truffle.api.interop.TruffleObject)1 ArrayTruffleObject (com.oracle.truffle.api.test.polyglot.ValueHostInteropTest.ArrayTruffleObject)1 Test (org.junit.Test)1