[squeak-dev] Re: SUnit infinite loop detection
Colin Putney
cputney at wiresong.ca
Sun Jul 6 20:52:02 UTC 2008
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
More information about the Squeak-dev
mailing list
|