Based on basic path testing, design the test cases for the following program:
public void nextday( )
{
switch( this.month)
{
case 1,3, 5, 7, 8, 10:
if( this.day == 31)
{
this.month = this.month + 1; this.day = 1;
}
else{ this.day = this.day + 1;
}
break;
case 4, 6, 9,11:
if( this.day == 30)
{
this.month = this.month + 1; this.day = 1;
}
else{ this.day = this.day + 1;
}
break;
case 12:
if( this.day == 31)
{
this.month = 1;
this.day = 1;
this.year = this.year + 1;
}
else
{
this.day = this.day + 1;
}
break;
case 2:
if( this.isleap())
{
if(this.day == 29)
{
20 this.day = 1
this.month = 3;
}
else{
this.day = this.day + 1;
}
}
else
{
23 if(this.day == 28)
{
this.day = 1; this.month = 3;
}
else
{
this.day = this.day + 1;
}
}
break;
}
}
Step 1: Draw the CFG.
Step 2: Compute the cyclomatic complexity number C, for the CFG
Step 3: Find at most C paths that cover the nodes and arcs in a CFG, also known as Basic Paths Set;
Step 4: Design test cases to force execution along paths in the Basic Paths Set. Requirements:
Please write down the result of every step.