use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class MethodGuardsTest method testComplexGuard.
@Test
public void testComplexGuard() {
CallTarget root = createCallTarget(GuardComplexTestFactory.getInstance());
assertEquals("do1", root.call(1));
assertEquals("do1", root.call(2));
assertEquals("do2", root.call(3));
assertEquals("do1", root.call(0));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class MethodGuardsTest method testGuardStaticField.
@Test
public void testGuardStaticField() {
CallTarget root = createCallTarget(GuardStaticFieldTestFactory.getInstance());
GuardStaticFieldTest.field = true;
assertEquals("do1", root.call(1));
assertEquals("do1", root.call(2));
GuardStaticFieldTest.field = false;
try {
root.call(2);
fail("expected Assertion failed");
} catch (AssertionError e) {
}
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class MethodGuardsTest method testGuardMethod.
@Test
public void testGuardMethod() {
CallTarget root = createCallTarget(GuardMethodTestFactory.getInstance());
assertEquals("do1", root.call(1));
assertEquals("do2", root.call(2));
assertEquals("do1", root.call(1));
assertEquals("do2", root.call(0));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class MethodGuardsTest method testMultipleGuardOrMethod.
@Test
public void testMultipleGuardOrMethod() {
CallTarget root = createCallTarget(GuardMultipleOrMethodTestFactory.getInstance());
assertEquals("do1", root.call(1));
assertEquals("do1", root.call(2));
assertEquals("do2", root.call(3));
assertEquals("do2", root.call(0));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class MethodGuardsTest method testGuardUnboundMethodField.
@Test
public void testGuardUnboundMethodField() {
CallTarget root = createCallTarget(GuardUnboundMethodTestFactory.getInstance());
GuardUnboundMethodTest node = getNode(root);
node.hiddenValue = true;
assertEquals("do1", root.call(1));
assertEquals("do1", root.call(2));
node.hiddenValue = false;
try {
root.call(2);
fail("expected Assertion failed");
} catch (AssertionError e) {
}
}
Aggregations