Wednesday, March 4, 2009

TDD and JPEG Compression

Bob Martin:

Suppose you wanted to set a bit somewhere that caused a low resolution image to be displayed rather than a high resolution image. How would you use TDD to get that to work? Would you write a test that scraped the screen to show that the image was in low res?

Of course not. You already know that the JPEG library works. You already know that if you call it with the right arguments it will display in low resolution. What you need to test is that the bit you set gets translated into the appropriate calls to the JPEG library.

Comments RSS · Twitter

Leave a Comment