How practical it is to do set-based comparison
in TestAsserter>>assertCollection:hasSameElements: ?

For example #(1 1 2) has same elements as #(1 2) which may make sense for
sets, but not for bags.

The main reason I was using it is that in tests the expected collection may
be created by hand,
which means it is very often an array #(...), { ... }, while models very
often return OrderedCollections (at least in my case).

So my question is --- how to compare collections irrespective of type, and
possibly of order?

A) always convert the actual collection toanArray

B) change difference: behavior for non-sets (ton of work with catastrophic
consequences)

C) extend TAssertable with new methods like

#assertElementsOf: actualCollection equals: expectedCollection
#assertUnorderedElementsOf: actualCollection equals: expectedCollection

C.a) directly in Pharo/SUnit
C.b) in independend SUnit-Extensions repository/project
C.c) just in my project

D) stop discussing non-problems

Thanks,
Peter

Reply via email to