Don't output remainders of previous conversions separately

Instead put them at the beginning of the next conversion to prevent
each remainder to be a few byte bytestring that is immediately followed
by a larger one.
Refactor test a bit to reduce code duplication