Testcases for Issue #769
implement encode logic and adapt testcases for issue #769
update and implement testcases for issue #888
implement encode logic and adapt testcases for issue #888
refactored testcases due to github-comments for issues #769 and #888
changed order of decoding due to github-comments for issues #769 and #888