Week 5

Re-requesting a Vanity Plate

The plate rules, split so a function returns valid or invalid.

You type

You write the tests. The function takes a plate.

The tool
One test can catch one broken rule A plate in Valid or invalid A test per rule
What comes out

Tests that catch a rule the function forgot.

The question, more slowly

The question is: the plate rules become a function that returns whether a plate is valid, and the tests poke each rule. A test that only checks one obviously valid plate will not notice a missing rule.

For each rule in the spec, invent one plate that should pass and one that fails that rule while passing the others, if you can. The failing plate is the one that proves the test is looking at the right rule.

People copy the plates from the original problem's demo and stop. Add the edge the spec mentions, especially the first number being zero and numbers that do not finish the plate.

Before you code

Pick one rule from the spec and write the plate that should fail it. That plate belongs in a test.