-
-
Notifications
You must be signed in to change notification settings - Fork 546
/
Copy pathcanonical-data.json
70 lines (70 loc) · 1.93 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
{
"#": [
"The only note about this exercise is to make sure that the methods used",
"to check if a number is valid and to compute its checksum DO NOT modify",
"the value of the internal attributes. ",
"I say this because I've seen for the Python testcases that it needs a last",
"test to call the validation method twice to assure this. ",
"Simply assure that the two methods are const methods (to use a C++ notation)",
"using the tools available in your language. ",
"Here is a pretty universal solution for the validation method: ",
"`return (0 === (this.checksum % 10)) ? true : false;`"
],
"cases": [
{
"description": "check digit",
"input": 34567,
"expected": 7
},
{
"description": "check digit with input ending in zero",
"input": 91370,
"expected": 0
},
{
"description": "check addends",
"input": 12121,
"expected": [1, 4, 1, 4, 1]
},
{
"description": "check too large addends",
"input": 8631,
"expected": [7, 6, 6, 1]
},
{
"description": "checksum",
"input": 4913,
"expected": 22
},
{
"description": "checksum of larger number",
"input": 201773,
"expected": 21
},
{
"description": "check invalid number",
"input": 738,
"expected": false
},
{
"description": "check valid number",
"input": 8739567,
"expected": true
},
{
"description": "create valid number",
"input": 123,
"expected": 1230
},
{
"description": "create larger valid number",
"input": 873956,
"expected": 8739567
},
{
"description": "create even larger valid number",
"input": 837263756,
"expected": 8372637564
}
]
}