Search in sources :

Example 1 with DynamicObjectFactory

use of com.oracle.truffle.api.object.DynamicObjectFactory in project graal by oracle.

the class InheritedShapePropertiesTest method testTop.

@Test
public void testTop() {
    final DynamicObjectFactory factory = TOP_LAYOUT.createInheritedShapeTopShape(14, 2);
    final DynamicObject object = TOP_LAYOUT.createInheritedShapeTop(factory);
    Assert.assertEquals(14, TOP_LAYOUT.getA(object));
    Assert.assertEquals(2, TOP_LAYOUT.getB(object));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 2 with DynamicObjectFactory

use of com.oracle.truffle.api.object.DynamicObjectFactory in project graal by oracle.

the class InheritedShapePropertiesTest method testBase.

@Test
public void testBase() {
    final DynamicObjectFactory factory = BASE_LAYOUT.createInheritedShapeBaseShape(14);
    final DynamicObject object = BASE_LAYOUT.createInheritedShapeBase(factory);
    Assert.assertEquals(14, BASE_LAYOUT.getA(object));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 3 with DynamicObjectFactory

use of com.oracle.truffle.api.object.DynamicObjectFactory in project graal by oracle.

the class ShapePropertiesTest method testObjectSetter.

@Test
public void testObjectSetter() {
    final DynamicObjectFactory factory = LAYOUT.createShapePropertiesTestShape(14);
    final DynamicObject object = LAYOUT.createShapePropertiesTest(factory, 22);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(object));
    LAYOUT.setShapeProperty(object, 44);
    Assert.assertEquals(44, LAYOUT.getShapeProperty(object));
    final DynamicObject newObject = LAYOUT.createShapePropertiesTest(factory, 22);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(newObject));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 4 with DynamicObjectFactory

use of com.oracle.truffle.api.object.DynamicObjectFactory in project graal by oracle.

the class ShapePropertiesTest method testObjectTypeGetter.

@Test
public void testObjectTypeGetter() {
    final DynamicObjectFactory factory = LAYOUT.createShapePropertiesTestShape(14);
    final DynamicObject object = LAYOUT.createShapePropertiesTest(factory, 22);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(object.getShape().getObjectType()));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 5 with DynamicObjectFactory

use of com.oracle.truffle.api.object.DynamicObjectFactory in project graal by oracle.

the class ShapePropertiesTest method testFactorySetter.

@Test
public void testFactorySetter() {
    final DynamicObjectFactory factory = LAYOUT.createShapePropertiesTestShape(14);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(factory));
    final DynamicObject object = LAYOUT.createShapePropertiesTest(factory, 22);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(object));
    final DynamicObjectFactory newFactory = LAYOUT.setShapeProperty(factory, 44);
    Assert.assertEquals(44, LAYOUT.getShapeProperty(newFactory));
    final DynamicObject newObject = LAYOUT.createShapePropertiesTest(newFactory, 22);
    Assert.assertEquals(44, LAYOUT.getShapeProperty(newObject));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Aggregations

DynamicObjectFactory (com.oracle.truffle.api.object.DynamicObjectFactory)13 Test (org.junit.Test)10 DynamicObject (com.oracle.truffle.api.object.DynamicObject)8 VariableElement (javax.lang.model.element.VariableElement)3 PropertyBuilder (com.oracle.truffle.object.dsl.processor.model.PropertyBuilder)2 TypeMirror (javax.lang.model.type.TypeMirror)2 Shape (com.oracle.truffle.api.object.Shape)1