[squeak-dev] Re: SUnit infinite loop detection

Igor Stasenko siguctua at gmail.com
Sun Jul 6 21:49:45 UTC 2008


Temporarily, replace a method in method dictionary with 'test' object
or compiled method
(Squeak can use any object as 'method', not just to a compiled method).
There you can inspect arguments and see, if your loop is still infinite.
Of course its implies , that you have sends within a loop, which can
be intercepted in that way.

2008/7/6 Colin Putney <cputney at wiresong.ca>:
>
> On 6-Jul-08, at 1:33 PM, nicolas cellier wrote:
>
>> Some infinite loops have been removed (presumably).
>> And I want to be able to write non regression SUnit tests that's all.
>>
>> How would you do it?
>
> It's try to find some way to measure the progress of the algorithm. If
> you're testing #printOn:, can you monitor the stream to see if any  digits
> have been printed? Are there some intermediate results that you can check?
>
> Another approach to isolate the bugfix and test that specifically. When you
> fixed the infinite loop, what did you change? Is there a way to test that in
> a narrow sense? For example, say the bug was that an index into an array
> wasn't getting incremented at the end of the loop. Now you've added code to
> do the increment. Is there a way to test that the index gets incremented
> rather than testing the overall behavior of the loop?
>
> Maybe this "untestability" is a code smell - perhaps there's some
> refactoring that could be done to expose more parts of the algorithm to
> testing in isolation.
>
> Colin
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list