Your right. Unfortunately, little diagrams on paper don't always make for good testcases. The +1 was a um...fencepost error!
1 2 3 4 5
2 3 4 5 6
1 2 3 4 <<< Range = 4 NOT!
Since when does a coder count from 1 not zero!
The idea was that if the range is negative, it has to be wrong so, no overlap. Which of course leads onto the second error.
My original tests were these.
I think I tried all the variations this time, but as always, better minds and different eyes may see it differently.
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead. |