Tests, semantics, and codegen for ternary operator, fix #61