1
Static Analysis Methods
CSSE 376 Software Quality Assurance
Rose-Hulman Institute of Technology
March 20, 2007
3
Cyclomatic Complexity
Measure of the complexity of a function Defines a minimum number of tests to run Vg = # regions of planar flow graph Vg = E - N + 2 (edges - nodes + 2) Vg = P + 1 (predicates + 1)
5
Using Cyclomatic Complexity
Vg is the number of independent paths through the function
Each path should be tested at least once Vg is also a measure of complexity: a large
value is a warning that the code may need extra testing or should be rewritten
7
Formal Verification
Compare implementation to a formal specification
Use rules like Assignment Axiom:
/* P(E) */
V = E;
/* P(V) */
8
Automated Support for Formal Verification Simple rules like Assignment Axiom can be
automated. Some formulas will need to be simplified for
tools to recognize similarity. Some theorems may need to be proved to
complete the verification
9
Symbolic Execution
Execution of code using symbolic values instead of real data
Compare symbolic values with expected values (results)
Path Condition: Condition on input variables under which this path is executed
Top Related