Skip to content

Commit

Permalink
Add test cases for issues in #324
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Sep 3, 2024
1 parent 39b0cea commit 48fd345
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
31 changes: 30 additions & 1 deletion tests/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class TestRegressions(unittest.TestCase):
def test_issue16(self):
def test_issue_16(self):
s = claripy.SolverComposite()

c = claripy.BVS("test", 32)
Expand All @@ -19,6 +19,35 @@ def test_issue16(self):
assert not s.satisfiable(extra_constraints=[claripy.BVS("lol", 32) == 0])
assert not s.satisfiable()

def test_issue_324(self):
s = claripy.Solver()
x = claripy.BVS("x", 64)
y = claripy.BVS("y", 64)
s.add(x - y >= 4)
s.add(y > 0)
assert s.min(x) == 0
assert s.min(x, extra_constraints=[x > 0]) == 1

def test_issue_325_2(self):
ast = claripy.BVS("a", 64) + 0xFF

s1 = claripy.Solver()

min_1 = s1.min(ast)
max_1 = s1.max(ast)
min_2 = s1.min(ast)
max_2 = s1.max(ast)

s2 = claripy.Solver()

min_3 = s2.min(ast)
max_3 = s2.max(ast)
min_4 = s2.min(ast)
max_4 = s2.max(ast)

assert min_1 == min_2 == min_3 == min_4
assert max_1 == max_2 == max_3 == max_4


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion tests/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class TestStrings(unittest.TestCase):
def get_solver(self):
return claripy.SolverStrings(backend=claripy.backends.z3)
return claripy.SolverStrings()

def test_concat(self):
str_concrete = claripy.StringV("conc")
Expand Down

0 comments on commit 48fd345

Please sign in to comment.