Reorganized the test suite into modules.

This makes it possible to separate views and tests. As a result the views in
the documentation could be replaced by an literalinclude. Now nearly all of the
code in the documentation is tested.