use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testMiddle.
@Test
public void testMiddle() {
final DynamicObject object = MIDDLE_LAYOUT.createMiddle(14, "foo");
Assert.assertEquals(14, MIDDLE_LAYOUT.getA(object));
MIDDLE_LAYOUT.setA(object, 22);
Assert.assertEquals(22, MIDDLE_LAYOUT.getA(object));
Assert.assertEquals("foo", MIDDLE_LAYOUT.getB(object));
MIDDLE_LAYOUT.setB(object, "bar");
Assert.assertEquals("bar", MIDDLE_LAYOUT.getB(object));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testMiddleGuardsOnBase.
@Test
public void testMiddleGuardsOnBase() {
final DynamicObject object = BASE_LAYOUT.createBase(14);
Assert.assertFalse(MIDDLE_LAYOUT.isMiddle(object));
Assert.assertFalse(MIDDLE_LAYOUT.isMiddle((Object) object));
Assert.assertFalse(MIDDLE_LAYOUT.isMiddle(object.getShape().getObjectType()));
Assert.assertFalse(MIDDLE_LAYOUT.isMiddle(object));
Assert.assertFalse(MIDDLE_LAYOUT.isMiddle((Object) object));
Assert.assertFalse(MIDDLE_LAYOUT.isMiddle(object.getShape().getObjectType()));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testTop.
@Test
public void testTop() {
final DynamicObject object = TOP_LAYOUT.createTop(14, "foo", BigInteger.TEN);
Assert.assertEquals(14, TOP_LAYOUT.getA(object));
BASE_LAYOUT.setA(object, 22);
Assert.assertEquals(22, BASE_LAYOUT.getA(object));
Assert.assertEquals("foo", TOP_LAYOUT.getB(object));
MIDDLE_LAYOUT.setB(object, "bar");
Assert.assertEquals("bar", MIDDLE_LAYOUT.getB(object));
Assert.assertEquals(BigInteger.TEN, TOP_LAYOUT.getC(object));
TOP_LAYOUT.setC(object, BigInteger.ONE);
Assert.assertEquals(BigInteger.ONE, TOP_LAYOUT.getC(object));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testBaseGuardsOnMiddle.
@Test
public void testBaseGuardsOnMiddle() {
final DynamicObject object = MIDDLE_LAYOUT.createMiddle(14, "foo");
Assert.assertTrue(BASE_LAYOUT.isBase(object));
Assert.assertTrue(BASE_LAYOUT.isBase((Object) object));
Assert.assertTrue(BASE_LAYOUT.isBase(object.getShape().getObjectType()));
Assert.assertTrue(BASE_LAYOUT.isBase(object));
Assert.assertTrue(BASE_LAYOUT.isBase((Object) object));
Assert.assertTrue(BASE_LAYOUT.isBase(object.getShape().getObjectType()));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class NullabilityTest method testSetNonNullableToNonNull.
@Test
public void testSetNonNullableToNonNull() {
final DynamicObject object = LAYOUT.createNullabilityTest("foo", "bar");
Assert.assertNotNull(object);
Assert.assertEquals("foo", LAYOUT.getNotNullable(object));
LAYOUT.setNotNullable(object, "baz");
Assert.assertEquals("baz", LAYOUT.getNotNullable(object));
}
Aggregations