changeset 58:b8b250033b5e

Updated testcase Now we are testing for a real range, not just single values
author Sigurd Meldgaard <stm@daimi.au.dk>
date Tue, 26 May 2009 17:35:27 +0200
parents 996d9e5da978
children 088168175adb
files pysmcl/test/unit/test_rangeanalysis.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/test/unit/test_rangeanalysis.py	Tue May 26 17:16:30 2009 +0200
+++ b/pysmcl/test/unit/test_rangeanalysis.py	Tue May 26 17:35:27 2009 +0200
@@ -69,12 +69,19 @@
 
     def test_range_minus(self):
         p = 7
-        prog = parse("def f(x):\n\tx=3\n\ty=2\n\tz=x-y\n")
+        prog = parse(
+"""
+def f(x):
+    a=3
+    if x:
+         a=a+1
+    z=a+2-a
+""")
         init_statements(prog)
         range_analysis = RangeAnalysis(p)
         range_analysis.apply(prog.body[0])
-        r = prog.body[0].body[2].out_values["range"]
-        self.assertEquals(r, {'y': (2, 2), 'x': (3, 3), 'z': (1, 1)})
+        r = prog.body[0].body[-1].out_values["range"]
+        self.assertEquals(r, {'a': (3, 4), 'x': (0, p), 'z': (1, 3)})
 
     def test_range_minus_wrap(self):
         p = 7