changeset 271:5b20b95549f3

test: removed debug-statement
author Sigurd Meldgaard <stm@daimi.au.dk>
date Wed, 10 Mar 2010 15:12:36 +0100
parents 1c640e470a51
children 289611112829
files pysmcl/test/unit/test_flow.py
diffstat 1 files changed, 38 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/test/unit/test_flow.py	Wed Mar 10 15:11:32 2010 +0100
+++ b/pysmcl/test/unit/test_flow.py	Wed Mar 10 15:12:36 2010 +0100
@@ -6,6 +6,8 @@
 from pysmcl.graph import Graph
 from pysmcl.flow import Flow
 
+from pysmcl.test.util import write_delta
+
 class FlowToDotTest(unittest.TestCase):
 
     def test_if(self):
@@ -20,8 +22,7 @@
 """)
         flow = Flow()
         flow.flow(prog.body[0])
-        entry = flow.to_dot(prog.body[0])
-        result = Graph(entry).to_dot_string()
+        result = flow.to_dot_string(prog.body[0])
         expected_result = \
 """digraph G {
   in -> 1
@@ -33,9 +34,9 @@
     3 [label="if(x):    a = a + 1"]
     3->4;
     3->5;
-    5 [label="a = a + 1"]
-    5->4;
-    4 [label="z = (a + 2) - a"]
+    5 [label="z = (a + 2) - a"]
+    4 [label="a = a + 1"]
+    4->5;
 }
 """
         self.assertEquals(result, expected_result)
@@ -54,27 +55,26 @@
 """)
         flow = Flow()
         flow.flow(prog.body[0])
-        entry = flow.to_dot(prog.body[0])
-        result = Graph(entry).to_dot_string()
+        result = flow.to_dot_string(prog.body[0])
         expected_result = \
 """digraph G {
-  in -> 6
+  in -> 1
   in [shape = plaintext, label=""]
-    6 [label="def f(x):    x = 3    y = 1    while(x > 0):        y = y + 1        x = x - 1    y"]
+    1 [label="def f(x):    x = 3    y = 1    while(x > 0):        y = y + 1        x = x - 1    y"]
+    1->2;
+    2 [label="x = 3"]
+    2->3;
+    3 [label="y = 1"]
+    3->4;
+    3->7;
+    7 [label="y"]
+    4 [label="while(x > 0):    y = y + 1    x = x - 1"]
+    4->5;
+    5 [label="y = y + 1"]
+    5->6;
+    6 [label="x = x - 1"]
+    6->4;
     6->7;
-    7 [label="x = 3"]
-    7->8;
-    8 [label="y = 1"]
-    8->9;
-    8->10;
-    10 [label="while(x > 0):    y = y + 1    x = x - 1"]
-    10->11;
-    11 [label="y = y + 1"]
-    11->12;
-    12 [label="x = x - 1"]
-    12->9;
-    12->10;
-    9 [label="y"]
 }
 """
         self.assertEquals(result, expected_result)
@@ -93,30 +93,28 @@
 """)
         flow = Flow()
         flow.flow(prog.body[0])
-        entry = flow.to_dot(prog.body[0])
-        result = Graph(entry).to_dot_string()
+        result = flow.to_dot_string(prog.body[0])
         expected_result = \
 """digraph G {
-  in -> 6
+  in -> 1
   in [shape = plaintext, label=""]
-    6 [label="def f(x):    x = 3    y = 1    for(x > 0):        y = y + 1        x = x - 1    y"]
+    1 [label="def f(x):    x = 3    y = 1    for i in range(10):        y = y + 1        x = x - 1    y"]
+    1->2;
+    2 [label="x = 3"]
+    2->3;
+    3 [label="y = 1"]
+    3->4;
+    3->7;
+    7 [label="y"]
+    4 [label="for i in range(10):    y = y + 1    x = x - 1"]
+    4->5;
+    5 [label="y = y + 1"]
+    5->6;
+    6 [label="x = x - 1"]
+    6->4;
     6->7;
-    7 [label="x = 3"]
-    7->8;
-    8 [label="y = 1"]
-    8->9;
-    8->10;
-    10 [label="for(x > 0):    y = y + 1    x = x - 1"]
-    10->11;
-    11 [label="y = y + 1"]
-    11->12;
-    12 [label="x = x - 1"]
-    12->9;
-    12->10;
-    9 [label="y"]
 }
 """
-        print result
         self.assertEquals(result, expected_result)