AlgoViz

Verifying and extending a design

medium 40 min

Before you say done, run your own code with real values and write down what each field holds.

Watch lesson4:30

Where it shows up

The same pattern appears across everyday software.

  • SQLite

    Its testing page describes four independently developed test harnesses, 100% branch coverage in an as-deployed configuration, and tests with simulated lack of memory and I/O errors.

  • Git fsck

    A command that verifies the connectivity and validity of the objects in the database: an invariant check that ships with the product.

  • pytest parametrize

    One test function and a table of inputs. Each row is run as its own test, like our fare table.

  • Go fuzzing

    Part of the Go tools: it changes inputs again and again and uses coverage to reach new paths. Inputs that fail are kept.

  • Hypothesis

    A Python library for property tests. Its stateful tests make up sequences of calls and can check invariants between them.

  • Java Clock

    The documentation says that using a clock object instead of a static method can simplify testing. A fixed clock is part of the library.

  • Chromium CHECK

    The C++ style guide uses CHECK and DCHECK to state that an invariant holds at a point in the program.

  • Python doctest

    It searches text for examples that look like interactive sessions, runs them, and reports where the answer differs. A trace that cannot become outdated unseen.

  • Formal methods at Amazon

    Engineers published a paper on writing precise models of their designs in TLA+ and letting a tool explore the states.