Static analysis of multiple if statements (conditions)
Posted
by koppernickus
on Stack Overflow
See other posts from Stack Overflow
or by koppernickus
Published on 2010-04-21T18:04:04Z
Indexed on
2010/04/21
18:13 UTC
Read the original article
Hit count: 437
I have code similar to:
if conditionA(x, y, z) then doA()
else if conditionB(x, y, z) then doB()
...
else if conditionZ(x, y, z) then doZ()
else throw ShouldNeverHappenException
I would like to validate two things (using static analysis):
- If all conditions
conditionA, conditionB, ..., conditionZ
are mutually exclusive (i.e. it is not possible that two or more conditions are true in the same time). - All possible cases are covered, i.e. "else throw" statement will never be called.
Could you recommend me a tool and/or a way I could (easily) do this?
I would appreciate more detailed informations than "use Prolog" or "use Mathematica"... ;-)
© Stack Overflow or respective owner