Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ExecuteEvaluatedTest.java @ 13272:0b8335a4fb13
Truffle-DSL: more testing for generating execute methods with varargs.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 02 Dec 2013 10:45:37 +0100 |
parents | 2b9fcffd6f36 |
children | 17b116b80aba |
comparison
equal
deleted
inserted
replaced
13271:2b9fcffd6f36 | 13272:0b8335a4fb13 |
---|---|
30 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.EvaluatedNodeFactory; | 30 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.EvaluatedNodeFactory; |
31 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedGenerationFactory; | 31 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedGenerationFactory; |
32 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs0Factory; | 32 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs0Factory; |
33 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs1Factory; | 33 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs1Factory; |
34 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs2Factory; | 34 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs2Factory; |
35 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs3Factory; | |
36 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs4Factory; | |
35 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseDoubleEvaluatedNodeFactory; | 37 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseDoubleEvaluatedNodeFactory; |
36 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseEvaluatedNodeFactory; | 38 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseEvaluatedNodeFactory; |
37 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode; | 39 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode; |
38 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ChildrenNode; | 40 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ChildrenNode; |
39 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestArguments; | 41 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestArguments; |
201 int call(int exp0, int exp1) { | 203 int call(int exp0, int exp1) { |
202 return exp0 + exp1; | 204 return exp0 + exp1; |
203 } | 205 } |
204 } | 206 } |
205 | 207 |
208 @Test | |
209 public void test3VarArgs1() { | |
210 TestRootNode<TestEvaluatedVarArgs3> root = TestHelper.createRoot(TestEvaluatedVarArgs3Factory.getInstance()); | |
211 Assert.assertEquals(42, root.getNode().execute1(null, 42)); | |
212 } | |
213 | |
214 @NodeChild | |
215 abstract static class TestEvaluatedVarArgs3 extends ValueNode { | |
216 | |
217 public abstract Object execute1(VirtualFrame frame, Object... value); | |
218 | |
219 @Specialization | |
220 int call(int exp0) { | |
221 return exp0; | |
222 } | |
223 } | |
224 | |
225 @Test | |
226 public void test4VarArgs1() { | |
227 TestRootNode<TestEvaluatedVarArgs4> root = TestHelper.createRoot(TestEvaluatedVarArgs4Factory.getInstance()); | |
228 Assert.assertEquals(42, root.getNode().execute1(null, 21, 21)); | |
229 } | |
230 | |
231 @NodeChildren({@NodeChild, @NodeChild}) | |
232 abstract static class TestEvaluatedVarArgs4 extends ValueNode { | |
233 | |
234 public abstract Object execute1(VirtualFrame frame, Object... value); | |
235 | |
236 @Specialization | |
237 int call(int exp0, int exp1) { | |
238 return exp0 + exp1; | |
239 } | |
240 } | |
241 | |
206 } | 242 } |