HomeChallengesRepsProblemsLeaderboardTake a challenge

One either side

Off-by-one is the most common bug there is. Test on the line and both sides of it.

Beginner12 min on the clock4 graded checks · 100 pointsTests That Catch Bugs
Graded by running your code against real cases.

What you build

  • Assert the lower boundary itself is allowed
  • Assert one below the lower boundary is not
  • Assert the upper boundary itself is allowed
  • Assert one above the upper boundary is not

Done means

Your suite passes a correct isEligible and fails all four off-by-one variants.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.

  1. It catches the lower boundary being excluded+25Off by one
  2. It catches the upper boundary being excluded+25Off by one
  3. It catches someone below the range getting in+25Off by one
  4. It catches someone above the range getting in+25Off by one

What it teaches

The rest of Tests That Catch Bugs