-
-
Notifications
You must be signed in to change notification settings - Fork 546
/
Copy pathcanonical-data.json
265 lines (265 loc) · 6.49 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
{
"exercise": "all-your-base",
"comments": [
"This canonical data makes the following choices:",
"1. Zero is always represented in outputs as [0] instead of [].",
"2. In no other instances are leading zeroes present in any outputs.",
"3. Leading zeroes are accepted in inputs.",
"4. An empty sequence of input digits is considered zero, rather than an error.",
"",
"Tracks that wish to make different decisions for these choices may translate appropriately.",
"",
"All your numeric-base are belong to [2..]. :)"
],
"cases": [
{
"uuid": "5ce422f9-7a4b-4f44-ad29-49c67cb32d2c",
"description": "single bit one to decimal",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [1],
"outputBase": 10
},
"expected": [1]
},
{
"uuid": "0cc3fea8-bb79-46ac-a2ab-5a2c93051033",
"description": "binary to single decimal",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [1, 0, 1],
"outputBase": 10
},
"expected": [5]
},
{
"uuid": "f12db0f9-0d3d-42c2-b3ba-e38cb375a2b8",
"description": "single decimal to binary",
"property": "rebase",
"input": {
"inputBase": 10,
"digits": [5],
"outputBase": 2
},
"expected": [1, 0, 1]
},
{
"uuid": "2c45cf54-6da3-4748-9733-5a3c765d925b",
"description": "binary to multiple decimal",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [1, 0, 1, 0, 1, 0],
"outputBase": 10
},
"expected": [4, 2]
},
{
"uuid": "65ddb8b4-8899-4fcc-8618-181b2cf0002d",
"description": "decimal to binary",
"property": "rebase",
"input": {
"inputBase": 10,
"digits": [4, 2],
"outputBase": 2
},
"expected": [1, 0, 1, 0, 1, 0]
},
{
"uuid": "8d418419-02a7-4824-8b7a-352d33c6987e",
"description": "trinary to hexadecimal",
"property": "rebase",
"input": {
"inputBase": 3,
"digits": [1, 1, 2, 0],
"outputBase": 16
},
"expected": [2, 10]
},
{
"uuid": "d3901c80-8190-41b9-bd86-38d988efa956",
"description": "hexadecimal to trinary",
"property": "rebase",
"input": {
"inputBase": 16,
"digits": [2, 10],
"outputBase": 3
},
"expected": [1, 1, 2, 0]
},
{
"uuid": "5d42f85e-21ad-41bd-b9be-a3e8e4258bbf",
"description": "15-bit integer",
"property": "rebase",
"input": {
"inputBase": 97,
"digits": [3, 46, 60],
"outputBase": 73
},
"expected": [6, 10, 45]
},
{
"uuid": "d68788f7-66dd-43f8-a543-f15b6d233f83",
"description": "empty list",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [],
"outputBase": 10
},
"expected": [0]
},
{
"uuid": "5e27e8da-5862-4c5f-b2a9-26c0382b6be7",
"description": "single zero",
"property": "rebase",
"input": {
"inputBase": 10,
"digits": [0],
"outputBase": 2
},
"expected": [0]
},
{
"uuid": "2e1c2573-77e4-4b9c-8517-6c56c5bcfdf2",
"description": "multiple zeros",
"property": "rebase",
"input": {
"inputBase": 10,
"digits": [0, 0, 0],
"outputBase": 2
},
"expected": [0]
},
{
"uuid": "3530cd9f-8d6d-43f5-bc6e-b30b1db9629b",
"description": "leading zeros",
"property": "rebase",
"input": {
"inputBase": 7,
"digits": [0, 6, 0],
"outputBase": 10
},
"expected": [4, 2]
},
{
"uuid": "a6b476a1-1901-4f2a-92c4-4d91917ae023",
"description": "input base is one",
"property": "rebase",
"input": {
"inputBase": 1,
"digits": [0],
"outputBase": 10
},
"expected": {
"error": "input base must be >= 2"
}
},
{
"uuid": "e21a693a-7a69-450b-b393-27415c26a016",
"description": "input base is zero",
"property": "rebase",
"input": {
"inputBase": 0,
"digits": [],
"outputBase": 10
},
"expected": {
"error": "input base must be >= 2"
}
},
{
"uuid": "54a23be5-d99e-41cc-88e0-a650ffe5fcc2",
"description": "input base is negative",
"property": "rebase",
"input": {
"inputBase": -2,
"digits": [1],
"outputBase": 10
},
"expected": {
"error": "input base must be >= 2"
}
},
{
"uuid": "9eccf60c-dcc9-407b-95d8-c37b8be56bb6",
"description": "negative digit",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [1, -1, 1, 0, 1, 0],
"outputBase": 10
},
"expected": {
"error": "all digits must satisfy 0 <= d < input base"
}
},
{
"uuid": "232fa4a5-e761-4939-ba0c-ed046cd0676a",
"description": "invalid positive digit",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [1, 2, 1, 0, 1, 0],
"outputBase": 10
},
"expected": {
"error": "all digits must satisfy 0 <= d < input base"
}
},
{
"uuid": "14238f95-45da-41dc-95ce-18f860b30ad3",
"description": "output base is one",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [1, 0, 1, 0, 1, 0],
"outputBase": 1
},
"expected": {
"error": "output base must be >= 2"
}
},
{
"uuid": "73dac367-da5c-4a37-95fe-c87fad0a4047",
"description": "output base is zero",
"property": "rebase",
"input": {
"inputBase": 10,
"digits": [7],
"outputBase": 0
},
"expected": {
"error": "output base must be >= 2"
}
},
{
"uuid": "13f81f42-ff53-4e24-89d9-37603a48ebd9",
"description": "output base is negative",
"property": "rebase",
"input": {
"inputBase": 2,
"digits": [1],
"outputBase": -7
},
"expected": {
"error": "output base must be >= 2"
}
},
{
"uuid": "0e6c895d-8a5d-4868-a345-309d094cfe8d",
"description": "both bases are negative",
"property": "rebase",
"input": {
"inputBase": -2,
"digits": [1],
"outputBase": -7
},
"expected": {
"error": "input base must be >= 2"
}
}
]
}