Skip to content

binary-search: Update json for new input policy #1040

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

Merged
merged 1 commit into from
Dec 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 41 additions & 21 deletions exercises/binary-search/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"exercise": "binary-search",
"version": "1.0.0",
"version": "1.1.0",
"comments": [
"Here -1 is used to indicate that the value is not included in the array.",
"It should be replaced with the respective expression that is idiomatic",
Expand All @@ -19,71 +19,91 @@
{
"description": "finds a value in an array with one element",
"property": "find",
"array": [6],
"value": 6,
"input": {
"array": [6],
"value": 6
},
"expected": 0
},
{
"description": "finds a value in the middle of an array",
"property": "find",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 6,
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 6
},
"expected": 3
},
{
"description": "finds a value at the beginning of an array",
"property": "find",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 1,
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 1
},
"expected": 0
},
{
"description": "finds a value at the end of an array",
"property": "find",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 11,
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 11
},
"expected": 6
},
{
"description": "finds a value in an array of odd length",
"property": "find",
"array": [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634],
"value": 144,
"input": {
"array": [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634],
"value": 144
},
"expected": 9
},
{
"description": "finds a value in an array of even length",
"property": "find",
"array": [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377],
"value": 21,
"input": {
"array": [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377],
"value": 21
},
"expected": 5
},
{
"description": "identifies that a value is not included in the array",
"property": "find",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 7,
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 7
},
"expected": -1
},
{
"description": "a value smaller than the array's smallest value is not included",
"property": "find",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 0,
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 0
},
"expected": -1
},
{
"description": "a value larger than the array's largest value is not included",
"property": "find",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 13,
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 13
},
"expected": -1
},
{
"description": "nothing is included in an empty array",
"property": "find",
"array": [],
"value": 1,
"input": {
"array": [],
"value": 1
},
"expected": -1
}
]
Expand Down