← Back to lesson 31: Prove the project is done

Prove the project is done: full examples and further reading

The original lesson material is preserved here for reference. The main notebook focuses on this lesson's core question.

The original English project below is a log cleaner. The current notebooks use the same file-statistics project as the Chinese route. These preserved examples show another application of the concepts; their inputs and expected outputs belong to the log cleaner.

Run the acceptance matrix, then finish with a short release checklist.

Execute every original example and produce one clear pass or fail result.

Run this first

Run it once, change one input, and compare the new result.

Original full example
%% Run each promise through the public parser
Cases = [
  {<<"INFO ready">>, {ok, {info, <<"ready">>}}},
  {<<>>, skip},
  {<<"BROKEN">>, {error, invalid_line}}
],
lists:all(fun({Input, Expected}) -> cleaner:parse_line(Input) =:= Expected end, Cases).

The acceptance result is true when all three promises still hold.

Steps for the full example

  1. Read lists:all/2: Confirm that every acceptance case passes.
  2. Read rebar3 do eunit, ct: Run unit and Common Test suites.
  3. Read $?: In a shell, inspect whether the command exited successfully.

Original lesson notes

Run the example first. Predict one result, then change one input and run it again.

A matrix runs agreed inputs through the public API and compares exact outputs.

A regression is old behavior that breaks after a later change.

Symbols and terms
lists:all/2
Confirm that every acceptance case passes.
rebar3 do eunit, ct
Run unit and Common Test suites.
$?
In a shell, inspect whether the command exited successfully.
acceptance matrix
A matrix runs agreed inputs through the public API and compares exact outputs.
regression
A regression is old behavior that breaks after a later change.
release checklist
A short checklist verifies tests, documentation, packaging, and known limits.

Original full exercise

Add the WARN case to the matrix.

Exercise starter
{<<"WARN hot">>, ____}

Use {ok,{warn,<<"hot">>}}.

Show hint

Copy the shape from the brief.

Show original answer
Reference answer
{<<"WARN hot">>, {ok, {warn, <<"hot">>}}}
Is a green acceptance matrix enough by itself?

No. Also run the suites, check docs, build the command, and record known limits.

Original lesson takeaways
Design trade-offs and language comparisons
Original course references