Professional Documents
Culture Documents
Simple Loop:
i=1;
while (i<10)
cout<<”Hello World”;
i++;
Nested Loop:
cout<<”*****”<<endl;
Condition coverage:
Statement Coverage:
If (a>b) {
c=a-b;
This code can have only ne test case in which the value of a is less than b.
Cin>>ch;
Switch(ch) {
This case will execute completely when there are two test cases i.e. when the choice entered by user is 1
and in the next test case when the choice entered by the user is 2.
Decision coverage:
2
YES NO
Is the num even
C
B
even=num*2 3
D
End if
4
YES No
num < 50
F G
I H
End if
Read num;
If (num%2!=0)
even=num*2;
end if
if (num<50)
end if
else
end else
Paths that ensure that all the edges are covered at least once:
1A-2C-3D-E-4G-6H
1A-2B-E-4F-5I