test for equality and hashcode