use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class ImplicitCastTest method testCanAssignIntToLong.
@Test
public void testCanAssignIntToLong() {
final DynamicObject object = CAST_LAYOUT.createCast(14, 14.2);
final Shape shapeBefore = object.getShape();
assertTrue(object.set(CastLayout.LONG_VALUE_IDENTIFIER, 14));
assertEquals(shapeBefore, object.getShape());
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testBaseOperationsOnTop.
@Test
public void testBaseOperationsOnTop() {
final DynamicObject object = TOP_LAYOUT.createTop(14, "foo", BigInteger.TEN);
Assert.assertEquals(14, BASE_LAYOUT.getA(object));
BASE_LAYOUT.setA(object, 22);
Assert.assertEquals(22, BASE_LAYOUT.getA(object));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testMiddleGuardsOnTop.
@Test
public void testMiddleGuardsOnTop() {
final DynamicObject object = TOP_LAYOUT.createTop(14, "foo", BigInteger.TEN);
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle((Object) object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object.getShape().getObjectType()));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle((Object) object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object.getShape().getObjectType()));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testTopGuardsOnBase.
@Test
public void testTopGuardsOnBase() {
final DynamicObject object = BASE_LAYOUT.createBase(14);
Assert.assertFalse(TOP_LAYOUT.isTop(object));
Assert.assertFalse(TOP_LAYOUT.isTop((Object) object));
Assert.assertFalse(TOP_LAYOUT.isTop(object.getShape().getObjectType()));
Assert.assertFalse(TOP_LAYOUT.isTop(object));
Assert.assertFalse(TOP_LAYOUT.isTop((Object) object));
Assert.assertFalse(TOP_LAYOUT.isTop(object.getShape().getObjectType()));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class InheritanceTest method testMiddleGuardsOnMiddle.
@Test
public void testMiddleGuardsOnMiddle() {
final DynamicObject object = MIDDLE_LAYOUT.createMiddle(14, "foo");
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle((Object) object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object.getShape().getObjectType()));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle((Object) object));
Assert.assertTrue(MIDDLE_LAYOUT.isMiddle(object.getShape().getObjectType()));
}
Aggregations