Add encoding tests.