use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class IdentifierTest method testContainsKey.
@Test
public void testContainsKey() {
final DynamicObject object = LAYOUT.createIdentifierTest(1, 2);
Assert.assertTrue(object.containsKey(IdentifierTestLayout.A_IDENTIFIER));
Assert.assertTrue(object.containsKey(IdentifierTestLayout.B_IDENTIFIER));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class IdentifierTest method testHasProperty.
@Test
public void testHasProperty() {
final DynamicObject object = LAYOUT.createIdentifierTest(1, 2);
Assert.assertTrue(object.getShape().hasProperty(IdentifierTestLayout.A_IDENTIFIER));
Assert.assertTrue(object.getShape().hasProperty(IdentifierTestLayout.B_IDENTIFIER));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class IdentifierTest method testGet.
@Test
public void testGet() {
final DynamicObject object = LAYOUT.createIdentifierTest(1, 2);
Assert.assertEquals(1, object.get(IdentifierTestLayout.A_IDENTIFIER));
Assert.assertEquals(2, object.get(IdentifierTestLayout.B_IDENTIFIER));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class ImplicitCastTest method testCanAssignIntToDouble.
@Test
public void testCanAssignIntToDouble() {
final DynamicObject object = CAST_LAYOUT.createCast(14, 14.2);
final Shape shapeBefore = object.getShape();
assertTrue(object.set(CastLayout.DOUBLE_VALUE_IDENTIFIER, 14));
assertEquals(shapeBefore, object.getShape());
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class ImplicitCastTest method testCantAssignIntToDouble.
@Test(expected = IncompatibleLocationException.class)
public void testCantAssignIntToDouble() throws IncompatibleLocationException, FinalLocationException {
final DynamicObject object = NO_CAST_LAYOUT.createNoCast(14, 14.2);
object.getShape().getProperty(NoCastLayout.DOUBLE_VALUE_IDENTIFIER).set(object, 14, object.getShape());
}
Aggregations