add tests for encodeOnly and decodeOnly

Ensure full test coverage.
Also provides examples.