for loop instead of compare for expeceted == given