Add encoding unit tests.