[Cuis-dev] [Integrated] Re: Fix for SequentiableCollection>>combinations:atATimeDo:
Hernan Wilkinson
hernan.wilkinson at 10pines.com
Sat May 25 06:05:55 PDT 2019
Hi Luciano,
thank you for the fix. It is integrated now and I added a couple of tests
to SequenceableCollectionTest, one when k is cero and another for the
normal case.
When I wrote the test for the normal case I notice that the collection
passed as parameter to the block it is always the name and therefore the
following test fails:
testCombinationsAtATimeDoWorksAsExpected
| combinations |
combinations := OrderedCollection new.
'abc' combinations: 2 atATimeDo: [ :combination | combinations add:
combination].
self assert: 3 equals: combinations size.
self assert: (combinations includes: #($a $b)).
self assert: (combinations includes: #($a $c)).
self assert: (combinations includes: #($b $c)).
To make it pass I had to make a copy of combination.
...
'abc' combinations: 2 atATimeDo: [ :combination | combinations add:
combination *copy*].
....
Is that the expected behavior? It looks weird to me... I would expect
combination to be different collections on each iteration...
Cheers!
Hernan.
On Thu, May 23, 2019 at 1:13 PM Luciano Notarfrancesco via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:
> The method was failing for the corner case of "combinations of 0
> elements". Here's the fix.
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
--
*HernĂ¡n WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190525/e7854bc7/attachment.html>
More information about the Cuis-dev
mailing list