use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class TypesTest method testBoolean.
@Test
public void testBoolean() {
final DynamicObject object = create();
Assert.assertEquals(true, LAYOUT.getB(object));
LAYOUT.setB(object, false);
Assert.assertEquals(false, LAYOUT.getB(object));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class TypesTest method testLong.
@Test
public void testLong() {
final DynamicObject object = create();
Assert.assertEquals(4, LAYOUT.getL(object));
LAYOUT.setL(object, 40);
Assert.assertEquals(40, LAYOUT.getL(object));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class VolatileTest method testCompareAndSetSuccess.
@Test
public void testCompareAndSetSuccess() {
final DynamicObject object = LAYOUT.createVolatileTest(14, null);
Assert.assertEquals(14, LAYOUT.getVolatileInt(object));
Assert.assertTrue(LAYOUT.compareAndSetVolatileInt(object, 14, 22));
Assert.assertEquals(22, LAYOUT.getVolatileInt(object));
Assert.assertNull(LAYOUT.getVolatileThread(object));
Assert.assertTrue(LAYOUT.compareAndSetVolatileThread(object, null, Thread.currentThread()));
Assert.assertEquals(Thread.currentThread(), LAYOUT.getVolatileThread(object));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class VolatileTest method testCompareAndSetFailure.
@Test
public void testCompareAndSetFailure() {
final DynamicObject object = LAYOUT.createVolatileTest(14, null);
Assert.assertEquals(14, LAYOUT.getVolatileInt(object));
Assert.assertFalse(LAYOUT.compareAndSetVolatileInt(object, 44, 22));
Assert.assertNull(LAYOUT.getVolatileThread(object));
Assert.assertFalse(LAYOUT.compareAndSetVolatileThread(object, Thread.currentThread(), Thread.currentThread()));
Assert.assertNull(LAYOUT.getVolatileThread(object));
}
use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.
the class VolatileTest method testGetVolatile.
@Test
public void testGetVolatile() {
final DynamicObject object = LAYOUT.createVolatileTest(14, null);
Assert.assertEquals(14, LAYOUT.getVolatileInt(object));
Assert.assertNull(LAYOUT.getVolatileThread(object));
}
Aggregations