Compare object equality instead of pointer equality in tests

{buildfix}