[Pharo-project] how this test can be right

Lukas Renggli renggli at gmail.com
Fri Jan 16 03:22:07 EST 2009


> I was never said that elements are iterate in a set the same way that
> they are added.

That's just by chance that it works, because the hash of a
SmallInteger is itself. As soon as the set starts to grow or as soon
as you don't add the numbers in order the result will be different. I
wouldn't write such a test, it depends on the internal implementation
of Set and SmallInteger and is likely to break.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch




More information about the Pharo-dev mailing list