-
-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trinary: Add canonical-data.json #510
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"to_decimal": { | ||
"description": "returns the decimal representation of the input trinary value", | ||
"cases": [ | ||
{ | ||
"description": "trinary 1 is decimal 1", | ||
"input": 1, | ||
"expected": 1 | ||
}, | ||
{ | ||
"description": "trinary 2 is decimal 2", | ||
"input": 2, | ||
"expected": 2 | ||
}, | ||
{ | ||
"description": "trinary 10 is decimal 3", | ||
"input": 10, | ||
"expected": 3 | ||
}, | ||
{ | ||
"description": "trinary 11 is decimal 4", | ||
"input": 11, | ||
"expected": 4 | ||
}, | ||
{ | ||
"description": "trinary 100 is decimal 9", | ||
"input": 100, | ||
"expected": 9 | ||
}, | ||
{ | ||
"description": "trinary 112 is decimal 14", | ||
"input": 112, | ||
"expected": 14 | ||
}, | ||
{ | ||
"description": "trinary 222 is decimal 26", | ||
"input": 222, | ||
"expected": 26 | ||
}, | ||
{ | ||
"description": "trinary 1122000120 is decimal 32091", | ||
"input": 1122000120, | ||
"expected": 32091 | ||
}, | ||
{ | ||
"description": "invalid trinary digits returns 0", | ||
"input": "1234", | ||
"expected": 0 | ||
}, | ||
{ | ||
"description": "invalid word as input returns 0", | ||
"input": "carrot", | ||
"expected": 0 | ||
}, | ||
{ | ||
"description": "invalid numbers with letters as input returns 0", | ||
"input": "0a1b2c", | ||
"expected": 0 | ||
} | ||
] | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Looks like binary and trinary started the same, but trinary didn't get the af4e4a0 treatment. That's too bad. I do dislike to encourage behaviour that can't distinguish between valid and invalid inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make these
{ expected: { error: "invalid input" }}
I suppose as I've been doing this work of generating the canonical, i wonder how much I'm supposed to make it match the tests that exist or if it's supposed to become the "rule" and i should just expect that the tests that are out there that don't match will someday get updated. It becomes about how much of these should be "what we think the canonical test suite should look like" and how much of it is "what the majority of tests say the canonical test suite is right now"