Skip to content

Commit

Permalink
[ISSUE 10] add unit test case to control correction
Browse files Browse the repository at this point in the history
  • Loading branch information
dedece35 committed Jan 4, 2024
1 parent 8bf211c commit 5981679
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/avoidMultipleIfElseStatementCompliant.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,19 @@ def compliant_variables_used_max_twice_in_if_orelif_statements_scenario_2():
else:
nb2 = 3
return nb2

# COMPLIANT
# USE CASE (secondary) : check no NullPointerException if no variables really used in conditions
# USE CASE : compliant use case to check if following is OK :
# - more than twice uses of the same variable
# - BUT not directly used, only inside a function
def compliant_the_same_variable_is_used_more_than_twice_but_inside_functions():
nb1 = 3
nb2 = 10
if len(nb1) == 1:
nb2 = 1
elif len(nb1) == 3:
nb2 = 2
else:
nb2 = 4
return nb2

0 comments on commit 5981679

Please sign in to comment.