diff test/testgraph.py @ 323:e9fe6988497c

Used burg for generating expressions
author Windel Bouwman
date Thu, 30 Jan 2014 19:03:24 +0100
parents 6753763d3bec
children b00219172a42
line wrap: on
line diff
--- a/test/testgraph.py	Mon Jan 27 19:58:07 2014 +0100
+++ b/test/testgraph.py	Thu Jan 30 19:03:24 2014 +0100
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 import unittest
-from ppci.codegen.graph import Graph, Node
+from ppci.codegen.graph import Graph, Node, DiGraph, DiNode
 from ppci.codegen.interferencegraph import InterferenceGraph
 from ppci.codegen.flowgraph import FlowGraph
 from ppci import ir
@@ -39,7 +39,20 @@
 
 
 class DigraphTestCase(unittest.TestCase):
-    pass
+    def testSuccessor(self):
+        g = DiGraph()
+        a = DiNode(g)
+        b = DiNode(g)
+        c = DiNode(g)
+        g.addNode(a)
+        g.addNode(b)
+        g.addNode(c)
+        g.addEdge(a, b)
+        g.addEdge(b, c)
+        self.assertEqual({b}, a.Succ)
+        self.assertEqual({b}, c.Pred)
+        g.delNode(c)
+        self.assertEqual(set(), b.Succ)
 
 
 class InterferenceGraphTestCase(unittest.TestCase):