-
-
Notifications
You must be signed in to change notification settings - Fork 550
/
Copy pathcanonical-data.json
139 lines (137 loc) · 3.92 KB
/
canonical-data.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{
"exercise": "binary-search",
"comments": [
"The error object 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/problem-specifications/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/problem-specifications/issues/244 for details."
],
"cases": [
{
"uuid": "b55c24a9-a98d-4379-a08c-2adcf8ebeee8",
"description": "finds a value in an array with one element",
"property": "find",
"input": {
"array": [6],
"value": 6
},
"expected": 0
},
{
"uuid": "73469346-b0a0-4011-89bf-989e443d503d",
"description": "finds a value in the middle of an array",
"property": "find",
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 6
},
"expected": 3
},
{
"uuid": "327bc482-ab85-424e-a724-fb4658e66ddb",
"description": "finds a value at the beginning of an array",
"property": "find",
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 1
},
"expected": 0
},
{
"uuid": "f9f94b16-fe5e-472c-85ea-c513804c7d59",
"description": "finds a value at the end of an array",
"property": "find",
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 11
},
"expected": 6
},
{
"uuid": "f0068905-26e3-4342-856d-ad153cadb338",
"description": "finds a value in an array of odd length",
"property": "find",
"input": {
"array": [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634],
"value": 144
},
"expected": 9
},
{
"uuid": "fc316b12-c8b3-4f5e-9e89-532b3389de8c",
"description": "finds a value in an array of even length",
"property": "find",
"input": {
"array": [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377],
"value": 21
},
"expected": 5
},
{
"uuid": "da7db20a-354f-49f7-a6a1-650a54998aa6",
"description": "identifies that a value is not included in the array",
"property": "find",
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 7
},
"expected": {
"error": "value not in array"
}
},
{
"uuid": "95d869ff-3daf-4c79-b622-6e805c675f97",
"description": "a value smaller than the array's smallest value is not found",
"property": "find",
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 0
},
"expected": {
"error": "value not in array"
}
},
{
"uuid": "8b24ef45-6e51-4a94-9eac-c2bf38fdb0ba",
"description": "a value larger than the array's largest value is not found",
"property": "find",
"input": {
"array": [1, 3, 4, 6, 8, 9, 11],
"value": 13
},
"expected": {
"error": "value not in array"
}
},
{
"uuid": "f439a0fa-cf42-4262-8ad1-64bf41ce566a",
"description": "nothing is found in an empty array",
"property": "find",
"input": {
"array": [],
"value": 1
},
"expected": {
"error": "value not in array"
}
},
{
"uuid": "2c353967-b56d-40b8-acff-ce43115eed64",
"description": "nothing is found when the left and right bounds cross",
"property": "find",
"input": {
"array": [1, 2],
"value": 0
},
"expected": {
"error": "value not in array"
}
}
]
}