Clean up and simplify the max-length self-test. The previous version was
confusing when debugging problems so we now do it after all other tests.