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 |
bump? :) On Tue, Sep 29, 2015 at 12:57 AM, Peter Uhnák <[hidden email]> wrote:
|
Hi Peter,
Le 24 oct. 2015 à 20:36, Peter Uhnák a écrit :
I introduced #assertCollection:hasSameElements: for this reason. The problem with using sets is that I do not expect that #(1 1 2) has same elements as #(1 2)
This solution has my preference
yes, for me, it is a very basic assertion that should be available as default.
Christophe smime.p7s (5K) Download Attachment |
Free forum by Nabble | Edit this page |