Mercurial > lcfOS
comparison 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 |
comparison
equal
deleted
inserted
replaced
322:44f336460c2a | 323:e9fe6988497c |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 import unittest | 3 import unittest |
4 from ppci.codegen.graph import Graph, Node | 4 from ppci.codegen.graph import Graph, Node, DiGraph, DiNode |
5 from ppci.codegen.interferencegraph import InterferenceGraph | 5 from ppci.codegen.interferencegraph import InterferenceGraph |
6 from ppci.codegen.flowgraph import FlowGraph | 6 from ppci.codegen.flowgraph import FlowGraph |
7 from ppci import ir | 7 from ppci import ir |
8 from ppci.irmach import AbstractInstruction as AI | 8 from ppci.irmach import AbstractInstruction as AI |
9 from target import Nop | 9 from target import Nop |
37 g.delNode(n2) | 37 g.delNode(n2) |
38 self.assertEqual(1, n1.Degree) | 38 self.assertEqual(1, n1.Degree) |
39 | 39 |
40 | 40 |
41 class DigraphTestCase(unittest.TestCase): | 41 class DigraphTestCase(unittest.TestCase): |
42 pass | 42 def testSuccessor(self): |
43 g = DiGraph() | |
44 a = DiNode(g) | |
45 b = DiNode(g) | |
46 c = DiNode(g) | |
47 g.addNode(a) | |
48 g.addNode(b) | |
49 g.addNode(c) | |
50 g.addEdge(a, b) | |
51 g.addEdge(b, c) | |
52 self.assertEqual({b}, a.Succ) | |
53 self.assertEqual({b}, c.Pred) | |
54 g.delNode(c) | |
55 self.assertEqual(set(), b.Succ) | |
43 | 56 |
44 | 57 |
45 class InterferenceGraphTestCase(unittest.TestCase): | 58 class InterferenceGraphTestCase(unittest.TestCase): |
46 def testNormalUse(self): | 59 def testNormalUse(self): |
47 t1 = ir.Temp('t1') | 60 t1 = ir.Temp('t1') |