use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class CachedTest method testBoundCacheOverflowContains.
@Test
public void testBoundCacheOverflowContains() {
CallTarget root = createCallTarget(TestBoundCacheOverflowContainsFactory.getInstance());
assertEquals(42, root.call(42));
assertEquals(43, root.call(43));
assertEquals(-1, root.call(44));
assertEquals(-1, root.call(42));
assertEquals(-1, root.call(43));
assertEquals(-1, root.call(44));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class CachedTest method testUnboundCache.
@Test
public void testUnboundCache() {
CallTarget root = createCallTarget(UnboundCacheFactory.getInstance());
assertEquals(42, root.call(42));
assertEquals(42, root.call(43));
assertEquals(42, root.call(44));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class ExecuteEvaluatedTest method testDoubleEvaluated2.
@Test
public void testDoubleEvaluated2() {
ArgumentNode arg0 = new ArgumentNode(0);
ArgumentNode arg1 = new ArgumentNode(1);
CallTarget callTarget = TestHelper.createCallTarget(UseDoubleEvaluated2NodeFactory.create(arg0, arg1, DoubleEvaluatedNodeFactory.create(null, null)));
Assert.assertEquals(42, callTarget.call(new Object[] { 1, 43 }));
Assert.assertEquals(1, arg0.getInvocationCount());
Assert.assertEquals(1, arg1.getInvocationCount());
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class ExecuteEvaluatedTest method testDoubleEvaluated1.
@Test
public void testDoubleEvaluated1() {
ArgumentNode arg0 = new ArgumentNode(0);
ArgumentNode arg1 = new ArgumentNode(1);
CallTarget callTarget = TestHelper.createCallTarget(UseDoubleEvaluated1NodeFactory.create(arg0, arg1, DoubleEvaluatedNodeFactory.create(null, null)));
Assert.assertEquals(42, callTarget.call(new Object[] { 43, 1 }));
Assert.assertEquals(1, arg0.getInvocationCount());
Assert.assertEquals(1, arg1.getInvocationCount());
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class IntegerLiteralGuardsTest method testOctalLiteral.
@Test
public void testOctalLiteral() {
CallTarget root = createCallTarget(OctalLiteralTestFactory.getInstance());
assertEquals("do1", root.call(12));
}
Aggregations