Search in sources :

Example 1 with ExampleArgumentNode

use of com.oracle.truffle.api.dsl.test.examples.ExampleNode.ExampleArgumentNode in project graal by oracle.

the class ImplicitCastTest method testImplicitCastExecute2.

@Test
public void testImplicitCastExecute2() {
    ExampleArgumentNode[] args = ExampleNode.createArguments(2);
    CallTarget target = ExampleNode.createTarget(ImplicitCastExecuteNodeGen.create(args));
    Assert.assertEquals("s2", target.call(1L, 1L));
    Assert.assertEquals(0, args[0].longInvocationCount);
    Assert.assertEquals(0, args[1].longInvocationCount);
    Assert.assertEquals(1, args[0].genericInvocationCount);
    Assert.assertEquals(1, args[1].genericInvocationCount);
    Assert.assertEquals("s2", target.call(1L, 1L));
    Assert.assertEquals(1, args[0].longInvocationCount);
    Assert.assertEquals(1, args[1].longInvocationCount);
    Assert.assertEquals(2, args[0].genericInvocationCount);
    Assert.assertEquals(2, args[1].genericInvocationCount);
    Assert.assertEquals("s2", target.call(1L, 1L));
    Assert.assertEquals(2, args[0].longInvocationCount);
    Assert.assertEquals(2, args[1].longInvocationCount);
    Assert.assertEquals(3, args[0].genericInvocationCount);
    Assert.assertEquals(3, args[1].genericInvocationCount);
    Assert.assertEquals(0, args[0].doubleInvocationCount);
    Assert.assertEquals(0, args[1].doubleInvocationCount);
    Assert.assertEquals(0, args[0].intInvocationCount);
    Assert.assertEquals(0, args[1].intInvocationCount);
}
Also used : CallTarget(com.oracle.truffle.api.CallTarget) ExampleArgumentNode(com.oracle.truffle.api.dsl.test.examples.ExampleNode.ExampleArgumentNode) Test(org.junit.Test)

Aggregations

CallTarget (com.oracle.truffle.api.CallTarget)1 ExampleArgumentNode (com.oracle.truffle.api.dsl.test.examples.ExampleNode.ExampleArgumentNode)1 Test (org.junit.Test)1