simplify the test.
move the test to encode.