From 50c3464c4bc876d1fd82962d70cebb93a765c4f5 Mon Sep 17 00:00:00 2001 From: Owlz Date: Thu, 7 Apr 2016 20:50:38 -0400 Subject: [PATCH] Proper Return function in loop testing --- tests/test_pyState_Call.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_pyState_Call.py b/tests/test_pyState_Call.py index dd75df1..08e3aec 100644 --- a/tests/test_pyState_Call.py +++ b/tests/test_pyState_Call.py @@ -143,6 +143,28 @@ def test(): x = test().rstrip(s1).rstrip(s2) """ +test14 = """ +def test(): + for x in range(10): + if x % 2 == 0: + return 0 + return 1 + +x = test() +""" + +def test_pySym_Return_Inside_Loop(): + b = ast.parse(test14).body + p = Path(b,source=test14) + pg = PathGroup(p) + + pg.explore() + + assert len(pg.completed) == 1 + + assert pg.completed[0].state.any_int('x') == 0 + + def test_pySym_Chained_AttrCall_Symbolic(): b = ast.parse(test13).body p = Path(b,source=test13)