use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class MethodGuardsTest method testGuardGreaterEqual.
@Test
public void testGuardGreaterEqual() {
CallTarget root = createCallTarget(GuardGreaterEqualTestFactory.getInstance());
assertEquals("do1", root.call(1));
assertEquals("do2", root.call(0));
assertEquals("do1", root.call(2));
assertEquals("do2", root.call(0));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class ArrayTest method testNode1.
@Test
public void testNode1() {
final TestNode1 node = TestNode1NodeGen.create(null);
RootNode root = new RootNode(null) {
@Child
TestNode1 test = node;
@Override
public Object execute(VirtualFrame frame) {
return test.executeWith(frame, frame.getArguments()[0]);
}
};
CallTarget target = Truffle.getRuntime().createCallTarget(root);
Assert.assertEquals(1, (int) target.call(1));
Assert.assertArrayEquals(new double[0], (double[]) target.call(new int[0]), 0.0d);
Assert.assertArrayEquals(new double[0], (double[]) target.call(new double[0]), 0.0d);
Assert.assertArrayEquals(new String[0], (String[]) target.call((Object) new String[0]));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class NullLiteralGuardsTest method testCompareObjectsNull.
@Test
public void testCompareObjectsNull() {
CallTarget root = createCallTarget(CompareObjectsNullNodeFactory.getInstance());
assertEquals("do1", root.call((Object) null));
assertEquals("do2", root.call("42"));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class NullLiteralGuardsTest method testCompareStringNull.
@Test
public void testCompareStringNull() {
CallTarget root = createCallTarget(CompareStringNullNodeFactory.getInstance());
assertEquals("do1", root.call("42"));
assertEquals("do2", root.call((Object) null));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class ImplicitCastTest method testImplicitCastExecute.
@Test
public void testImplicitCastExecute() {
CallTarget target = ExampleNode.createTarget(ImplicitCastExecuteNodeGen.create(ExampleNode.createArguments(2)));
Assert.assertEquals("s1", target.call(1, 2D));
Assert.assertEquals("s0", target.call(1, 1));
target = ExampleNode.createTarget(ImplicitCastExecuteNodeGen.create(ExampleNode.createArguments(2)));
Assert.assertEquals("s0", target.call(1, 1));
Assert.assertEquals("s1", target.call(1, 2D));
target = ExampleNode.createTarget(ImplicitCastExecuteNodeGen.create(ExampleNode.createArguments(2)));
Assert.assertEquals("s0", target.call(1, 1));
Assert.assertEquals("s2", target.call(1, 2L));
target = ExampleNode.createTarget(ImplicitCastExecuteNodeGen.create(ExampleNode.createArguments(2)));
Assert.assertEquals("s2", target.call(1, 2L));
Assert.assertEquals("s0", target.call(1, 1));
}
Aggregations