Software Testing CS4153 - 3
Software Testing CS4153 - 3
• For(i=0;i>b;i++)
1 if(a>b) then
2 c=3;
3 else c=5;
4 c=c*c;
Example_3
1. for(i=0;i>b;i++)
2. {if(a>b) then c=3;
3. else
4. c=5;
5. c=c*c;
6. }
7. Print;
Example_4
• Iteration:
1 do{
2 b=b*a;
3 b=b-1;}
4 }while(a>b)
5 c=b+d;
Path
• A path through a program:
a node and edge sequence from the starting node to a
terminal node of the control flow graph.
There may be several terminal nodes for program.
Independent Path
• Any path through the program:
introducing at least one new node:
that is not included in any other independent paths.
Independent Path
• It is straight forward:
• to identify linearly independent paths of simple
programs.
• For complicated programs:
• it is not so easy to determine the number of
independent paths.
McCabe's cyclomatic metric
• An upper bound:
for the number of linearly independent paths of a program