Support platforms that don't provide strnlen().
Rename helpers.h -> test_helpers.h.

Make it clearer what this header file is actually for.
More use of 'tee'.
Refactor out print_transition().

This code will be useful elsewhere.