Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ImplicitCastTest.java @ 14632:5f5e2711dc24
fix TruffleDSL tests
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Thu, 20 Mar 2014 03:14:12 +0100 |
parents | 5a0c694ef735 |
children | 5148aab962af |
comparison
equal
deleted
inserted
replaced
14631:97321295c974 | 14632:5f5e2711dc24 |
---|---|
69 | 69 |
70 @Test | 70 @Test |
71 public void testImplicitCast0() { | 71 public void testImplicitCast0() { |
72 ImplicitCast0Node node = ImplicitCast0NodeFactory.create(null); | 72 ImplicitCast0Node node = ImplicitCast0NodeFactory.create(null); |
73 TestRootNode<ImplicitCast0Node> root = new TestRootNode<>(node); | 73 TestRootNode<ImplicitCast0Node> root = new TestRootNode<>(node); |
74 root.adoptChildren(); | |
74 Assert.assertEquals("2", root.getNode().executeEvaluated(null, "2")); | 75 Assert.assertEquals("2", root.getNode().executeEvaluated(null, "2")); |
75 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); | 76 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); |
76 Assert.assertEquals("1", root.getNode().executeEvaluated(null, "1")); | 77 Assert.assertEquals("1", root.getNode().executeEvaluated(null, "1")); |
77 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); | 78 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); |
78 Assert.assertEquals(true, root.getNode().executeEvaluated(null, true)); | 79 Assert.assertEquals(true, root.getNode().executeEvaluated(null, true)); |
104 | 105 |
105 @Test | 106 @Test |
106 public void testImplicitCast1() { | 107 public void testImplicitCast1() { |
107 ImplicitCast1Node node = ImplicitCast1NodeFactory.create(null); | 108 ImplicitCast1Node node = ImplicitCast1NodeFactory.create(null); |
108 TestRootNode<ImplicitCast1Node> root = new TestRootNode<>(node); | 109 TestRootNode<ImplicitCast1Node> root = new TestRootNode<>(node); |
110 root.adoptChildren(); | |
109 Assert.assertEquals("2", root.getNode().executeEvaluated(null, "2")); | 111 Assert.assertEquals("2", root.getNode().executeEvaluated(null, "2")); |
110 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); | 112 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); |
111 Assert.assertEquals("1", root.getNode().executeEvaluated(null, "1")); | 113 Assert.assertEquals("1", root.getNode().executeEvaluated(null, "1")); |
112 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); | 114 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1)); |
113 Assert.assertEquals(true, root.getNode().executeEvaluated(null, true)); | 115 Assert.assertEquals(true, root.getNode().executeEvaluated(null, true)); |
144 | 146 |
145 @Test | 147 @Test |
146 public void testImplicitCast2() { | 148 public void testImplicitCast2() { |
147 ImplicitCast2Node node = ImplicitCast2NodeFactory.create(null, null); | 149 ImplicitCast2Node node = ImplicitCast2NodeFactory.create(null, null); |
148 TestRootNode<ImplicitCast2Node> root = new TestRootNode<>(node); | 150 TestRootNode<ImplicitCast2Node> root = new TestRootNode<>(node); |
151 root.adoptChildren(); | |
149 Assert.assertEquals("42", root.getNode().executeEvaluated(null, "4", "2")); | 152 Assert.assertEquals("42", root.getNode().executeEvaluated(null, "4", "2")); |
150 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1, 1)); | 153 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1, 1)); |
151 Assert.assertEquals("42", root.getNode().executeEvaluated(null, "4", "2")); | 154 Assert.assertEquals("42", root.getNode().executeEvaluated(null, "4", "2")); |
152 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1, 1)); | 155 Assert.assertEquals(true, root.getNode().executeEvaluated(null, 1, 1)); |
153 Assert.assertEquals(true, root.getNode().executeEvaluated(null, true, true)); | 156 Assert.assertEquals(true, root.getNode().executeEvaluated(null, true, true)); |