Skip to content
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
160 changes: 86 additions & 74 deletions exercises/binary-search/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,90 @@
{
"#": [
"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",
"for the language that implements the tests.",
"exercise": "binary-search",
"version": "1.0.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",
"for the language that implements the tests.",

"Following https://github.com/exercism/x-common/issues/234 the exercise",
"should NOT include checking whether the array is sorted as it defeats",
"the point of the binary search.",
"Following https://github.com/exercism/x-common/issues/234 the exercise",
"should NOT include checking whether the array is sorted as it defeats",
"the point of the binary search.",

"The exercise should utilize an array-like (i.e. constant-time indexed)",
"data structure and not a linked list. If something like an array is not",
"usually used in the language the problem should not be implemented.",
"See https://github.com/exercism/x-common/issues/244 for details."
],
"cases": [
{
"description": "finds a value in an array with one element",
"array": [6],
"value": 6,
"expected": 0
},
{
"description": "finds a value in the middle of an array",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 6,
"expected": 3
},
{
"description": "finds a value at the beginning of an array",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 1,
"expected": 0
},
{
"description": "finds a value at the end of an array",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 11,
"expected": 6
},
{
"description": "finds a value in an array of odd length",
"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",
"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",
"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",
"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",
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 13,
"expected": -1
},
{
"description": "nothing is included in an empty array",
"array": [],
"value": 1,
"expected": -1
}
]
"The exercise should utilize an array-like (i.e. constant-time indexed)",
"data structure and not a linked list. If something like an array is not",
"usually used in the language the problem should not be implemented.",
"See https://github.com/exercism/x-common/issues/244 for details."
],
"cases": [
{
"description": "finds a value in an array with one element",
"property": "find",
"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,
"expected": 3
},
{
"description": "finds a value at the beginning of an array",
"property": "find",
"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,
"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,
"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,
"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,
"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,
"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,
"expected": -1
},
{
"description": "nothing is included in an empty array",
"property": "find",
"array": [],
"value": 1,
"expected": -1
}
]
}