Ejemplo n.º 1
0
 void compareTwoDifferentVars(LocalVariable lv1, LocalVariable lv2) {
   if (!lv1.equals(lv2)) {
     println(" Success: difference of local vars detected");
   } else {
     failure(" Failure: difference of local vars is NOT detected");
   }
   if (lv1.hashCode() != lv2.hashCode()) {
     println(" Success: hashCode's of different local vars differ");
   } else {
     failure(" Failure: hashCode's of different local vars are equal");
   }
   if (lv1.compareTo(lv2) != 0) {
     println(" Success: compareTo() is correct for different local vars");
   } else {
     failure(" Failure: compareTo() is NOT correct for different local vars");
   }
 }
Ejemplo n.º 2
0
 void compareTwoEqualVars(LocalVariable lv1, LocalVariable lv2) {
   if (lv1.equals(lv2)) {
     println(" Success: equality of local vars detected");
   } else {
     failure(" Failure: equality of local vars is NOT detected");
   }
   if (lv1.hashCode() == lv2.hashCode()) {
     println(" Success: hashCode's of equal local vars are equal");
   } else {
     failure(" Failure: hashCode's of equal local vars differ");
   }
   if (lv1.compareTo(lv2) == 0) {
     println(" Success: compareTo() is correct for equal local vars");
   } else {
     failure(" Failure: compareTo() is NOT correct for equal local vars");
   }
 }