Skip to content

Tests as Documentation

Gregg Reynolds edited this page May 3, 2014 · 2 revisions

One way to support easy discoverability would be to support a “minimal semantic demonstration” (MSD) of the code. This would amount to a specialized variety of unit test. Invoking MSD on a function would result in a display of the form “application -> output” which would demonstrate the semantics in action. For example:

(msd ‘factorial)
-- MSD:  factorial
    (factorial 0) -> 1
    (factorial 1) -> 1
    (factorial 2) -> 2
    (factorial 3) -> 6
    (factorial 4) -> 24

Implementing this as a kind of unit test would serve both as a minimal QA device and as a discovery device.

Clone this wiki locally