forked from exercism/problem-specifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinary.json
79 lines (79 loc) · 1.93 KB
/
binary.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
{
"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": "2 is not a valid binary digit",
"binary": "2",
"expected": null
},
{
"description": "a number containing a non-binary digit is invalid",
"binary": "01201",
"expected": null
},
{
"description": "a number with trailing non-binary characters is invalid",
"binary": "10nope",
"expected": null
},
{
"description": "a number with leading non-binary characters is invalid",
"binary": "nope10",
"expected": null
},
{
"description": "a number with internal non-binary characters is invalid",
"binary": "10nope10",
"expected": null
},
{
"description": "a number and a word whitespace spearated is invalid",
"binary": "001 nope",
"expected": null
}
]
}