Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor VSA test cases to use union method instead of _merge_si #604

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions tests/test_vsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ def test_value_set_operations(self):
assert vsa_model(vs_1).is_empty

# Test merging two addresses
vsa_model(vs_1)._merge_si("global", 0, vsa_model(claripy.SI(bits=32, stride=0, lower_bound=10, upper_bound=10)))
vsa_model(vs_1)._merge_si("global", 0, vsa_model(claripy.SI(bits=32, stride=0, lower_bound=28, upper_bound=28)))
vs_1 = vs_1.union(VS(32, "global", 0, claripy.SI(bits=32, stride=0, lower_bound=10, upper_bound=10)))
vs_1 = vs_1.union(VS(32, "global", 0, claripy.SI(bits=32, stride=0, lower_bound=28, upper_bound=28)))
assert (
vsa_model(vs_1)
.get_si("global")
Expand All @@ -644,14 +644,12 @@ def test_value_set_operations(self):
vs_2 = VS(name="foo", bits=32, value=0).intersection(VS(name="makeitempty", bits=32, value=1))
assert self.is_equal(vs_1, vs_1)
assert self.is_equal(vs_2, vs_2)
vsa_model(vs_1)._merge_si("global", 0, vsa_model(claripy.SI(bits=32, stride=0, lower_bound=10, upper_bound=10)))
vs_1 = vs_1.union(VS(32, "global", 0, claripy.SI(bits=32, stride=0, lower_bound=10, upper_bound=10)))
assert not self.is_equal(vs_1, vs_2)
vsa_model(vs_2)._merge_si("global", 0, vsa_model(claripy.SI(bits=32, stride=0, lower_bound=10, upper_bound=10)))
vs_2 = vs_2.union(VS(32, "global", 0, claripy.SI(bits=32, stride=0, lower_bound=10, upper_bound=10)))
assert self.is_equal(vs_1, vs_2)
assert claripy.backends.vsa.is_true((vs_1 & vs_2) == vs_1)
vsa_model(vs_1)._merge_si(
"global", 0, vsa_model(claripy.SI(bits=32, stride=18, lower_bound=10, upper_bound=28))
)
vs_1 = vs_1.union(VS(32, "global", 0, claripy.SI(bits=32, stride=18, lower_bound=10, upper_bound=28)))
assert not self.is_equal(vs_1, vs_2)

def test_value_set_subtraction(self):
Expand Down
Loading