Added some test cases for encoding.