Search in sources :

Example 1 with ArgumentNode

use of com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode in project graal by oracle.

the class ExecuteEvaluatedTest method testSingleEvaluated.

@Test
public void testSingleEvaluated() {
    ArgumentNode arg0 = new ArgumentNode(0);
    CallTarget callTarget = TestHelper.createCallTarget(UseEvaluatedNodeFactory.create(arg0, EvaluatedNodeFactory.create(null)));
    Assert.assertEquals(43, callTarget.call(new Object[] { 42 }));
    Assert.assertEquals(1, arg0.getInvocationCount());
}
Also used : CallTarget(com.oracle.truffle.api.CallTarget) ArgumentNode(com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode) Test(org.junit.Test)

Example 2 with ArgumentNode

use of com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode 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());
}
Also used : CallTarget(com.oracle.truffle.api.CallTarget) ArgumentNode(com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode) Test(org.junit.Test)

Example 3 with ArgumentNode

use of com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode 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());
}
Also used : CallTarget(com.oracle.truffle.api.CallTarget) ArgumentNode(com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode) Test(org.junit.Test)

Aggregations

CallTarget (com.oracle.truffle.api.CallTarget)3 ArgumentNode (com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode)3 Test (org.junit.Test)3