Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/PolymorphicTest2.java @ 16756:5148aab962af
Truffle-DSL: updated tests for the new generation layout.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 15:53:05 +0200 |
parents | f0bb82ebe30c |
children | a665483c3881 |
comparison
equal
deleted
inserted
replaced
16755:bd28da642eea | 16756:5148aab962af |
---|---|
27 | 27 |
28 import org.junit.*; | 28 import org.junit.*; |
29 | 29 |
30 import com.oracle.truffle.api.dsl.*; | 30 import com.oracle.truffle.api.dsl.*; |
31 import com.oracle.truffle.api.dsl.test.BinaryNodeTest.BinaryNode; | 31 import com.oracle.truffle.api.dsl.test.BinaryNodeTest.BinaryNode; |
32 import com.oracle.truffle.api.dsl.test.PolymorphicTest2Factory.Node1Factory; | 32 import com.oracle.truffle.api.dsl.test.PolymorphicTest2Factory.Polymorphic1Factory; |
33 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; | 33 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; |
34 import com.oracle.truffle.api.nodes.*; | 34 import com.oracle.truffle.api.nodes.*; |
35 | 35 |
36 public class PolymorphicTest2 { | 36 public class PolymorphicTest2 { |
37 | 37 |
38 @Test | 38 @Test |
39 public void testMultipleTypes() { | 39 public void testMultipleTypes() { |
40 /* Tests the unexpected polymorphic case. */ | 40 /* Tests the unexpected polymorphic case. */ |
41 TestRootNode<Node1> node = TestHelper.createRoot(Node1Factory.getInstance()); | 41 TestRootNode<Polymorphic1> node = TestHelper.createRoot(Polymorphic1Factory.getInstance()); |
42 assertEquals(21, executeWith(node, false, false)); | 42 assertEquals(21, executeWith(node, false, false)); |
43 assertEquals(42, executeWith(node, 21, 21)); | 43 assertEquals(42, executeWith(node, 21, 21)); |
44 assertEquals("(boolean,int)", executeWith(node, false, 42)); | 44 assertEquals("(boolean,int)", executeWith(node, false, 42)); |
45 assertEquals(NodeCost.POLYMORPHIC, node.getNode().getCost()); | 45 assertEquals(NodeCost.POLYMORPHIC, node.getNode().getCost()); |
46 } | 46 } |
47 | 47 |
48 @SuppressWarnings("unused") | 48 @SuppressWarnings("unused") |
49 @PolymorphicLimit(3) | 49 abstract static class Polymorphic1 extends BinaryNode { |
50 abstract static class Node1 extends BinaryNode { | |
51 | 50 |
52 @Specialization(order = 1) | 51 @Specialization(order = 1) |
53 int add(int left, int right) { | 52 int add(int left, int right) { |
54 return 42; | 53 return 42; |
55 } | 54 } |