


Calculating Cyclomatic
Complexity
V(G)
= No. Of regions
= 7
V(G)
=Edges – Nodes +2
=20-15 +2 =7
V(G)
=Predicate Nodes +1
= 6+1 =7
Using a depth-first search, the basic sets of linearly
independent paths through the flowgraph are:
1)
1, 2, 3, 4, 1 4) 1, 2, 6, 7, 9,
10,1 7) 1, 2, 6, 12, 15
2)
1, 2, 3, 5, 1 5) 1, 2, 6, 7, 9, 11, 1
3)
1, 2, 6, 7, 8,1 6) 1, 2, 6, 12, 13, 14, 1
Derivation of Test Cases
|
Path 1 (1,
2, 3, 4, 1)
Test Case 1:
Inputs
:
Time period
status
Premium
slots
Expected Results:
Number of
hours booked
Subprogram: Compute Charge
Path 2 (1,
2, 3, 5, 1)
Test Case 1:
Inputs :
Time period
status
Premium
slots
Expected Results:
Compute the
number of hours expired and fine
Subprogram: Compute Charge
Path 3 (1,
2, 6, 7, 8, 1)
Test Case 1:
Inputs :
Time period
status
Normal slots
Expected Results:
Return 0, no
slots book
Subprogram: Compute Charge
|
Path 4 (1,
2, 6, 7, 9, 10, 1)
Test Case 1:
Inputs :
Time period
status
Normal
slots
Expected Results:
Compute
charge for peak hours
Subprogram: Compute Charge
Path 5 (1,
2, 6, 7, 9 , 11, 1)
Test Case 1:
Inputs :
Time period
status
Normal slots
Expected Results:
Compute
charges for non peak hours
Subprogram: Compute Charge
|
|
Path 6 (1,
2, 6, 12, 13, 14, 1)
Test Case 1:
Inputs :
Time period
status
Normal slots
Expected Results:
Compute the
number of hours expired and fine
Subprogram: Compute Charge
|
Path 7 (1,
2, 6, 12 , 15)
Test Case 1:
Inputs :
Time
period status
Normal
Premium slots
Expected Results:
Compute
rate excluding fine
Subprogram: Compute Charge
|
|