Hi Peter,

Le 24 oct. 2015 à 20:36, Peter Uhnák a écrit :

> bump? :)
> 
> On Tue, Sep 29, 2015 at 12:57 AM, Peter Uhnák <i.uh...@gmail.com> wrote:
> 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).


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)

> 
> 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

This solution has my preference

> C.a) directly in Pharo/SUnit

yes, for me, it is a very basic assertion that should be available as default.

> C.b) in independend SUnit-Extensions repository/project
> C.c) just in my project
> 
> D) stop discussing non-problems
> 
> Thanks,
> Peter
> 

Christophe

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to