Add tests (fixes #1813).
More.