Hacker News new | ask | show | jobs
by wizardofoz 6159 days ago
Code that test the finite switch:

3. for (int i = 0; i < iteration; i++) {

4. testSwitchFinite(i);

5. }

Once i > 5, testSwitchFinite will always skip to default. This function doesn't even test the switch properly.

Something like testSwitchFinite(i%5+1) would have made more sense (for the finite switch and if-else.)