Skip to content

Commit

Permalink
test case for the for-loop
Browse files Browse the repository at this point in the history
  • Loading branch information
leovt committed Feb 28, 2012
1 parent dcf328a commit 1824f77
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions interp_test.py
Expand Up @@ -21,5 +21,21 @@ def test():

self.assertEqual(expected, realized)

def test_loop(self):
"""
Testing a for loop. In addition to printing build a checksum
so that we can test a meaningful return value.
"""
def test():
ret = 0
for i in range(10):
print i
ret = ret + i
return ret

expected = test()
realized = interp.execute(test.func_code, {'range': range})


if __name__ == '__main__':
unittest.main()

0 comments on commit 1824f77

Please sign in to comment.