Fix choice encoding

Fixes bug #15 - choice encoding had no tests and was broken
`} else if (...) {`