Change test code to print proper hex dump on output content mismatch
Move code block for consistency between libraries, no functional change