[Pharo-users] TestAsserter>>assertCollection:hasSameElements:

Peter Uhnák i.uhnak at gmail.com
Sat Oct 24 14:36:48 EDT 2015


bump? :)

On Tue, Sep 29, 2015 at 12:57 AM, Peter Uhnák <i.uhnak at 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).
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20151024/d7501645/attachment.html>


More information about the Pharo-users mailing list