Choose a minimal set of discriminating examples

You are selecting the next examples for a TDD test list. A reservation function accepts an integer number of seats nn, from 0 through 10, and returns a charge in cents. Zero seats cost zero. A positive reservation costs 200 cents for the first seat plus 50 cents for each additional seat, capped at 400 cents.


The only existing assertion checks zero seats. Each of the following incomplete implementations passes it:


Python
def flat_fee(n):
    return 0 if n == 0 else 200

def early_cap(n):
    return 0 if n == 0 else min(400, 200 + 50 * n)

def uncapped(n):
    return 0 if n == 0 else 200 + 50 * (n - 1)


Each additional test must assert the correct returned charge for exactly one positive integer input. Tests are evaluated separately against each implementation. What is the minimum number of additional test cases needed so that every incomplete implementation fails at least one selected test? Answer as an exact integer number of test cases.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Test-Driven Development Questions: