Search in sources :

Example 81 with DynamicObject

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

the class ObjectTypeTest method objectTypeRespondsToIsNull.

@Test
public void objectTypeRespondsToIsNull() {
    final Layout layout = Layout.newLayout().build();
    final Shape rootShape = layout.createShape(OBJECT_TYPE);
    final DynamicObject obj = rootShape.newInstance();
    final boolean is = JavaInteropTest.isNull(obj);
    assertFalse("It is not null", is);
}
Also used : Shape(com.oracle.truffle.api.object.Shape) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Layout(com.oracle.truffle.api.object.Layout) Test(org.junit.Test)

Example 82 with DynamicObject

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

the class ObjectTypeTest method objectTypeRespondsToIsBoxed.

@Test
public void objectTypeRespondsToIsBoxed() {
    final Layout layout = Layout.newLayout().build();
    final Shape rootShape = layout.createShape(OBJECT_TYPE);
    final DynamicObject obj = rootShape.newInstance();
    final boolean is = JavaInteropTest.isBoxed(obj);
    assertFalse("It is not boxed", is);
}
Also used : Shape(com.oracle.truffle.api.object.Shape) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Layout(com.oracle.truffle.api.object.Layout) Test(org.junit.Test)

Example 83 with DynamicObject

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

the class BasicTest method testGetDefault.

@Test
public void testGetDefault() {
    final DynamicObject object = LAYOUT.createBasicTest(14);
    Assert.assertEquals(14, LAYOUT.getValue(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 84 with DynamicObject

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

the class FinalPropertiesTest method testGetDefault.

@Test
public void testGetDefault() {
    final DynamicObject object = LAYOUT.createFinalPropertiesTest(14);
    Assert.assertEquals(14, LAYOUT.getValue(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 85 with DynamicObject

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

the class FinalPropertiesTest method testCreate.

@Test
public void testCreate() {
    final DynamicObject object = LAYOUT.createFinalPropertiesTest(14);
    Assert.assertNotNull(object);
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Aggregations

DynamicObject (com.oracle.truffle.api.object.DynamicObject)100 Test (org.junit.Test)91 Location (com.oracle.truffle.api.object.Location)17 Shape (com.oracle.truffle.api.object.Shape)16 DynamicObjectFactory (com.oracle.truffle.api.object.DynamicObjectFactory)8 ObjectLocation (com.oracle.truffle.api.object.ObjectLocation)7 Property (com.oracle.truffle.api.object.Property)7 ObjectType (com.oracle.truffle.api.object.ObjectType)6 IncompatibleLocationException (com.oracle.truffle.api.object.IncompatibleLocationException)4 Layout (com.oracle.truffle.api.object.Layout)4 FinalLocationException (com.oracle.truffle.api.object.FinalLocationException)2 PropertyBuilder (com.oracle.truffle.object.dsl.processor.model.PropertyBuilder)2 VariableElement (javax.lang.model.element.VariableElement)2 LocationFactory (com.oracle.truffle.api.object.LocationFactory)1 ShapeImpl (com.oracle.truffle.object.ShapeImpl)1 DefaultLayoutFactory (com.oracle.truffle.object.basic.DefaultLayoutFactory)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1 IdentityHashMap (java.util.IdentityHashMap)1