int isOlder(char *dob1, char *dob2) { int index,value,check1,check2; for (index = 0; index < 10; index++) { if (index==2||index==5) { if (dob1[index] != '-' || dob2[index] != '-') return -1; } else { if (dob1[index]<'0' || dob1[index]>'9' || dob2[index]<'0' || dob2[index]>'9') return -1; } } check1 = Validity(dob1); check2 = Validity(dob2); if (check1==-1||check2==-1) { return -1; } else { for (index = 6; index < 10; index++) { if (dob1[index]>dob2[index]) return 2; else { if (dob1[index] < dob2[index]) return 1; } } for (index = 3; index < 5; index++) { if (dob1[index]>dob2[index]) return 2; else { if (dob1[index] < dob2[index]) return 1; } } for (index = 0; index < 2; index++) { if (dob1[index]>dob2[index]) return 2; else { if (dob1[index] < dob2[index]) return 1; } } return 0; } }
int main(int argc, char **argv) { plan_tests(11); Validity v; v.Clear(); ok1(!v.IsValid()); v.Update(100); ok1(v.IsValid()); v.Expire(101, 5); ok1(v.IsValid()); v.Expire(105, 5); ok1(v.IsValid()); v.Expire(106, 5); ok1(!v.IsValid()); v.Update(100); ok1(v.Modified(Validity(99))); ok1(!v.Modified(Validity(100))); ok1(!v.Modified(Validity(101))); ok1(!v.Complement(Validity(1))); v.Clear(); ok1(!v.Complement(invalid())); ok1(v.Complement(Validity(1))); return exit_status(); }
nsresult nsIConstraintValidation::GetValidity(nsIDOMValidityState** aValidity) { NS_ENSURE_ARG_POINTER(aValidity); NS_ADDREF(*aValidity = Validity()); return NS_OK; }