Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
bannsec committed Mar 30, 2016
1 parent cbaaea1 commit 0697f5a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyObjectManager/String.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def mustBe(self,var):
# Loop through all our characters and see if they have more than one possibility
for c in self:
# If this has more than one option, return False
if self.state.any_n_int(c,2) == 2:
if len(self.state.any_n_int(c,2)) == 2:
return False

# Looks like we've got a match...
Expand Down
23 changes: 23 additions & 0 deletions tests/test_function_String_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@
x = s.index("{0}")
"""

test2 = """
s = pyState.String(10)
x = s.index('a')
"""

def test_function_String_Index_Symbolic():
b = ast.parse(test2).body
p = Path(b,source=test2)
pg = PathGroup(p)

pg.explore()

# Every index should be a possibility
assert len(pg.completed) == 10

indexes = []
# Make sure we got all of them
for path in pg.completed:
indexes.append(path.state.any_int('x'))

assert set(indexes) == set(range(10))


def test_function_String_Index():
b = ast.parse(test1.format("T")).body
p = Path(b,source=test1.format("T"))
Expand Down

0 comments on commit 0697f5a

Please sign in to comment.