Question: Design test cases for the program segment below using basic path testing (please follow the steps of basic path testing, 15 points). public void nextday(
Design test cases for the program segment below using basic path testing (please follow the steps of basic path testing, 15 points).
public void nextday( ){
1 switch( this.month){
2 case 1,3, 5, 7, 8, 10:
3 if( this.day == 31){
4 this.month = this.month + 1; this.day = 1; }
5 else{ this.day = this.day + 1; }
6 break;
7 case 4, 6, 9,11:
8 if( this.day == 30){
9 this.month = this.month + 1; this.day = 1; }
10 else{ this.day = this.day + 1; }
11 break;
12 case 12:
13 if( this.day == 31){
14 this.month = 1; this.day = 1; this.year = this.year + 1; }
15 else{ this.day = this.day + 1; }
16 break;
17 case 2:
18 if( this.isleap()){
19 if(this.day == 29) {
20 this.day = 1; this.month = 3; }
21 else{ this.day = this.day + 1; }
}
22 else{
23 if(this.day == 28){
24 this.day = 1; this.month = 3; }
25 else{ this.day = this.day + 1; }
}
26 break;
27 }
28 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
