34 import org.graalvm.compiler.nodeinfo.NodeInfo; 35 36 public class NodeValidationChecksTest extends GraphTest { 37 38 @NodeInfo(cycles = CYCLES_UNKNOWN, size = SIZE_UNKNOWN) 39 static final class TestNode extends Node { 40 public static final NodeClass<TestNode> TYPE = NodeClass.create(TestNode.class); 41 42 @Input TestNode input; 43 @Successor TestNode successor; 44 45 protected TestNode(TestNode input, TestNode successor) { 46 super(TYPE); 47 this.input = input; 48 this.successor = successor; 49 } 50 } 51 52 @Test 53 public void testInputNotAlive() { 54 Graph graph = new Graph(getOptions()); 55 TestNode node = new TestNode(null, null); 56 try { 57 graph.add(new TestNode(node, null)); 58 Assert.fail("Exception expected."); 59 } catch (AssertionError e) { 60 Assert.assertTrue(e.getMessage().contains("Input")); 61 Assert.assertTrue(e.getMessage().contains("not alive")); 62 } 63 } 64 65 @Test 66 public void testSuccessorNotAlive() { 67 Graph graph = new Graph(getOptions()); 68 TestNode node = new TestNode(null, null); 69 try { 70 graph.add(new TestNode(null, node)); 71 Assert.fail("Exception expected."); 72 } catch (AssertionError e) { 73 Assert.assertTrue(e.getMessage().contains("Successor")); 74 Assert.assertTrue(e.getMessage().contains("not alive")); 75 } 76 } 77 } | 34 import org.graalvm.compiler.nodeinfo.NodeInfo; 35 36 public class NodeValidationChecksTest extends GraphTest { 37 38 @NodeInfo(cycles = CYCLES_UNKNOWN, size = SIZE_UNKNOWN) 39 static final class TestNode extends Node { 40 public static final NodeClass<TestNode> TYPE = NodeClass.create(TestNode.class); 41 42 @Input TestNode input; 43 @Successor TestNode successor; 44 45 protected TestNode(TestNode input, TestNode successor) { 46 super(TYPE); 47 this.input = input; 48 this.successor = successor; 49 } 50 } 51 52 @Test 53 public void testInputNotAlive() { 54 Graph graph = new Graph(getOptions(), getDebug()); 55 TestNode node = new TestNode(null, null); 56 try { 57 graph.add(new TestNode(node, null)); 58 Assert.fail("Exception expected."); 59 } catch (AssertionError e) { 60 Assert.assertTrue(e.getMessage().contains("Input")); 61 Assert.assertTrue(e.getMessage().contains("not alive")); 62 } 63 } 64 65 @Test 66 public void testSuccessorNotAlive() { 67 Graph graph = new Graph(getOptions(), getDebug()); 68 TestNode node = new TestNode(null, null); 69 try { 70 graph.add(new TestNode(null, node)); 71 Assert.fail("Exception expected."); 72 } catch (AssertionError e) { 73 Assert.assertTrue(e.getMessage().contains("Successor")); 74 Assert.assertTrue(e.getMessage().contains("not alive")); 75 } 76 } 77 } |