HomeChallengesRepsProblemsLeaderboardTake a challenge

The cases nobody writes

Empty, single, negative, fractional. Where production actually breaks.

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

What you build

  • Test the empty array — it must give 0, not NaN
  • Test a single-element array
  • Test an array containing negative numbers
  • Test an average that is not a whole number

Done means

Your suite passes a correct average and fails four that each break at one edge.

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 NaN on an empty array+30The cases nobody writes
  2. It catches a broken single-element case+25The cases nobody writes
  3. It catches negatives being dropped+25The cases nobody writes
  4. It catches a rounded result+20The cases nobody writes

What it teaches

The cases nobody writesbeginner

Production breaks on the empty list, the single item and the negative number — not on the example you had in mind when you wrote the function.

The rest of Tests That Catch Bugs