50% of all instance-methods are unary ! was: 84% of all instance-methods are unary !

Nevin Pratt nevin at smalltalkpro.com
Fri Jun 13 13:13:40 UTC 2003



Stephane Ducasse wrote:

> Markus
>
> even if you find unary messages this does not mean that we will have 
> an  easy test coverage.
> For example
>     Browser open
>
> is unary but try to come up with a test for the browser
>
> Stef


You only have to test that a browser window actually opened.

1. First, build a collection 'A' of all currently open windows.
2. Now do 'aWindow := Browser open'.
3. Now build another collection 'B' of all currently open windows
4. Is size of collection 'B' one greater than size of collection 'A'?
5. Is 'aWindow' the exact same window as the extra window in 'B'?
6. Send 'aWindow close' (or 'aWindow window close', depending on the 
dialect)
7. Now build a collection 'C' of all currently open windows.
8. Is collection 'A' the same size as collection 'C'?
9. Does collection 'A' have the same elements as collection 'C'?

-- 
Nevin Pratt
Bountiful Baby
http://www.bountifulbaby.com
(801) 992-3137





More information about the Squeak-dev mailing list