-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add example test cases for redundant_assignment and missing_ret…
…urn z3 options
- Loading branch information
1 parent
887565f
commit 7b8658f
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
examples/custom_checkers/z3_option/z3_e9959_redundant_assignment.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def func(x: int) -> int: | ||
''' | ||
Preconditions: | ||
- x > 10 | ||
''' | ||
a = 10 | ||
if x > 0: # by function precondition, this condition is True | ||
a = 20 # `a` is reassigned before first use | ||
return a |
8 changes: 8 additions & 0 deletions
8
examples/custom_checkers/z3_option/z3_r9711_missing_return_statement.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def func(x: int) -> int: | ||
''' | ||
Preconditions: | ||
- x in [1, 2, 3, 4, 5] | ||
''' | ||
if x > 5: | ||
return x | ||
print(x) |