-
-
Notifications
You must be signed in to change notification settings - Fork 550
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
binary: Add test data for "binary" exercise #296
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"decimal": [ | ||
{ | ||
"description": "binary 0 is decimal 0", | ||
"binary": "0", | ||
"expected": 0 | ||
}, | ||
{ | ||
"description": "binary 1 is decimal 1", | ||
"binary": "1", | ||
"expected": 1 | ||
}, | ||
{ | ||
"description": "binary 10 is decimal 2", | ||
"binary": "10", | ||
"expected": 2 | ||
}, | ||
{ | ||
"description": "binary 11 is decimal 3", | ||
"binary": "11", | ||
"expected": 3 | ||
}, | ||
{ | ||
"description": "binary 100 is decimal 4", | ||
"binary": "100", | ||
"expected": 4 | ||
}, | ||
{ | ||
"description": "binary 1001 is decimal 9", | ||
"binary": "1001", | ||
"expected": 9 | ||
}, | ||
{ | ||
"description": "binary 11010 is decimal 26", | ||
"binary": "11010", | ||
"expected": 26 | ||
}, | ||
{ | ||
"description": "binary 10001101000 is decimal 1128", | ||
"binary": "10001101000", | ||
"expected": 1128 | ||
}, | ||
{ | ||
"description": "binary ignores leading zeros", | ||
"binary": "000011111", | ||
"expected": 31 | ||
}, | ||
{ | ||
"description": "numbers other than one and zero raise an error", | ||
"binary": ["012", "2"], | ||
"expected": -1 | ||
}, | ||
{ | ||
"description": "containing letters raises an error", | ||
"binary": ["10nope", "nope10", "10nope10", "001 nope"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Binary should never be an array. |
||
"expected": -1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure -1 is the right value to expect in the case of an error, it probably should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think -1 is fine as long as we note somewhere that it's a place-holder for an error. Each track can deal with it as they please. |
||
} | ||
] | ||
} |
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.
This should become 2 tests,
and
Discussion required: I'm not 100% sure null is the correct expected value here if we want to indicate in a general way that an error should be raised.