It would be great if you could add some comments here indicating what each of the six (!) conditional clauses are checking for. I know the tests are probably exercising each possibility, but it's hard for me to tell which test corresponds to which clause.