changeset 50:a192b4becf2e

Added a test for handling global variables.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 26 May 2009 16:36:36 +0200
parents 049fc91f5bef
children 709a931db194
files pysmcl/test/unit/test_rangeanalysis.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/test/unit/test_rangeanalysis.py	Tue May 26 16:34:21 2009 +0200
+++ b/pysmcl/test/unit/test_rangeanalysis.py	Tue May 26 16:36:36 2009 +0200
@@ -137,14 +137,14 @@
         r = prog.body[0].body[0].out_values["range"]
         self.assertEquals(r, {'x': (0, 1)})
 
-#     def test_range_global_variable(self):
-#         p = 7
-#         prog = parse("x=42\ndef f():\n\tx")
-#         init_statements(prog)
-#         range_analysis = RangeAnalysis(p)
-#         range_analysis.apply(prog.body[0])
-#         r = prog.body[0].body[1].out_values["range"]
-#         self.assertEquals(r, {'x': (0, p)})
+    def test_range_global_variable(self):
+        p = 7
+        prog = parse("def f():\n\tx")
+        init_statements(prog)
+        range_analysis = RangeAnalysis(p)
+        range_analysis.apply(prog.body[0])
+        r = prog.body[0].body[0].out_values["range"]
+        self.assertEquals(r, {'_': (0, p)})
 
 if __name__ == '__main__':
     unittest.main()