SWE 637 Quiz Number 10
April 9, 2012



Consider the isLeap example from a prior quiz. Notice that, contrary to the advice for ACC testing, the predicate has been decomposed. ROR mutation testing effectively reassembles the predicate from the ACC perspective.
// Note:  Only applies to non negative years
public static boolean isLeap (int year) {

   if (year % 4   != 0) return false;
   if (year % 400 == 0) return true;
   if (year % 100 == 0) return false;
   return true;
}

The following table lists several ROR mutants. State in the right 4 columns the mutant output and also whether the given input kills the mutant or leaves it live. Note that the output of the original program is given at the top of the column.
Use strong mutation analysis in formulating your answers. The first row is given as a sample.
  Original   Mutant
  2011: false  
  2000: true  
  1900: false  
  2012: true  
  year % 4 != 0   year % 4 >= 0   false / live   false / killed   false / live   false / killed
  year % 4 != 0   year % 4 > 0        
  year % 400 == 0   false        
  year % 100 == 0   true        


Answer:
  Original   Mutant
  2011: false  
  2000: true  
  1900: false  
  2012: true  
  year % 4 != 0   year % 4 >= 0   false / live   false / killed   false / live   false / killed
  year % 4 != 0   year % 4 > 0   false / live   true / live   false / live   true / live
  year % 400 == 0   false   false / live   false / killed   false / live   true / live
  year % 100 == 0   true   false / live   true / live   false / live   false / killed

Note that the table only includes "normal" years. Certainly, other years (zero, negative) could be used to kill mutants.