Skip to content

Instantly share code, notes, and snippets.

@kruszczynski
Created August 25, 2026 09:30
Show Gist options
  • Select an option

  • Save kruszczynski/1e243e47c42f1b51755b88efb9f8c724 to your computer and use it in GitHub Desktop.

Select an option

Save kruszczynski/1e243e47c42f1b51755b88efb9f8c724 to your computer and use it in GitHub Desktop.
Tennis tournament exercise, part 04

Stage 4: hostile inputs

The match list arrives as JSON over an API from a third party. You do not control what they send.

[]                                        # no matches at all
[["Alice", "Alice"]]                      # a player against themselves
[["Alice", "Bob"], ["Alice", "Bob"]]      # the same match twice
[["Alice"]]                               # arity is not guaranteed
[["Alice", "Bob", "Charlie"]]             # nor is it capped
[["Alice", "Bob"], ["alice", "Bob"]]      # is this two players or one?

For each: what does your code currently do, and what should it do? Not every one of these is an error. Decide which are, and say what the caller sees in each case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment