-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
0 additions
and
36 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,37 +1 @@ | ||
from lizard_languages.code_reader import CodeStateMachine, next_if_branch_coverage, print_next_if_coverage | ||
|
||
def test_next_if_token_not_equal(): | ||
next_if_branch_coverage["token_not_equal_branch"] = False | ||
next_if_branch_coverage["token_equal_branch"] = False | ||
|
||
mock_context = {} | ||
instance = CodeStateMachine(mock_context) | ||
|
||
instance.next = lambda state, token: None | ||
|
||
instance.next_if("state1", "token1", "expected") | ||
assert next_if_branch_coverage["token_not_equal_branch"] is True | ||
assert next_if_branch_coverage["token_equal_branch"] is False | ||
|
||
print("After testing token not equal case:") | ||
print_next_if_coverage() | ||
|
||
def test_next_if_token_equal(): | ||
next_if_branch_coverage["token_not_equal_branch"] = False | ||
next_if_branch_coverage["token_equal_branch"] = False | ||
|
||
mock_context = {} | ||
instance = CodeStateMachine(mock_context) | ||
|
||
instance.next = lambda state, token: None | ||
|
||
instance.next_if("state1", "expected", "expected") | ||
assert next_if_branch_coverage["token_not_equal_branch"] is False | ||
assert next_if_branch_coverage["token_equal_branch"] is True | ||
|
||
print("After testing token equal case:") | ||
print_next_if_coverage() | ||
|
||
if __name__ == "__main__": | ||
test_next_if_token_not_equal() | ||
test_next_if_token_equal() |