Use a while loop for index equality.
Add more tests for equality correctness.