exercism/xgo — pull request #51 by soniakeys (2014-06-08 00:15:39+00:00)
Title: add exercise trinary

Another in the sequence of number conversions. In the test data I included an overflow case but no invalid syntax cases. The required parse functions in the four exercises binary, octal, trinary, and hexadecimal all have the same basic signature now of returning an integer value and an error of the Go error type. Probably this is best as otherwise experienced Go programmers will constantly be annoyed and be trying to change it. Next I'd like to actually remove the invalid syntax test cases from the binary example so the sequence of exercises would go,

1. Binary, returns error type, but all test cases will be valid and error checking can be skirted by simply returning nil for the error. A comment in the test program (or readme) might say that error checking can be omitted or implemented as a bonus exercise.
2. Octal, returns error type and some test cases have invalid syntax. Syntax errors anyway are no longer a bonus exercise. Solutions must catch this and return an error.
3. Trinary, returns error type and some test cases overflow the integer result. Solutions must catch this and return an error. I'm putting this after octal in the config because I suspect most people will find testing for overflow more challenging than testing for invalid syntax.
4. Hexadecimal, returns error type and test data includes both invalid syntax and overflow cases. Solutions must catch both and return a distinguishable error. Solutions must also include a function that handles the error return and correctly identifies what kind of error was returned.