The Wheels on The Bus Go Round and Round...

Feb 2, 2011 19:32 · 81 words · 1 minute read Java

I am working on a project that requires byte level bit manipulating. I wanted to test if my code worked on every byte value. Given that bytes are nice & small, I could actually achieve 100% test coverage. I wrote the following to test all combinations.

for (byte rawByte=Byte.MIN_VALUE; rawByte<=Byte.MAX_VALUE; rawByte++) {
    testCombination(b, mask, rawByte);

The test did not fail. But it did not stop either. Took me 15 minutes to figure that one out. How long do you need?