Add encode decode unit tests