Skip to content

Commit e0358d3

Browse files
authored
luhn: Apply new "input" policy (#1054)
* luhn: Apply new "input" policy Per #996 * luhn: change "ccNumber" to "value"
1 parent 19b4d9b commit e0358d3

File tree

1 file changed

+40
-14
lines changed

1 file changed

+40
-14
lines changed

exercises/luhn/canonical-data.json

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,109 @@
11
{
22
"exercise": "luhn",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"cases": [
55
{
66
"description": "single digit strings can not be valid",
77
"property": "valid",
8-
"input": "1",
8+
"input": {
9+
"value": "1"
10+
},
911
"expected": false
1012
},
1113
{
1214
"description": "a single zero is invalid",
1315
"property": "valid",
14-
"input": "0",
16+
"input": {
17+
"value": "0"
18+
},
1519
"expected": false
1620
},
1721
{
1822
"description": "a simple valid SIN that remains valid if reversed",
1923
"property": "valid",
20-
"input": "059",
24+
"input": {
25+
"value": "059"
26+
},
2127
"expected": true
2228
},
2329
{
2430
"description": "a simple valid SIN that becomes invalid if reversed",
2531
"property": "valid",
26-
"input": "59",
32+
"input": {
33+
"value": "59"
34+
},
2735
"expected": true
2836
},
2937
{
3038
"description": "a valid Canadian SIN",
3139
"property": "valid",
32-
"input": "055 444 285",
40+
"input": {
41+
"value": "055 444 285"
42+
},
3343
"expected": true
3444
},
3545
{
3646
"description": "invalid Canadian SIN",
3747
"property": "valid",
38-
"input": "055 444 286",
48+
"input": {
49+
"value": "055 444 286"
50+
},
3951
"expected": false
4052
},
4153
{
4254
"description": "invalid credit card",
4355
"property": "valid",
44-
"input": "8273 1232 7352 0569",
56+
"input": {
57+
"value": "8273 1232 7352 0569"
58+
},
4559
"expected": false
4660
},
4761
{
4862
"description": "valid strings with a non-digit included become invalid",
4963
"property": "valid",
50-
"input": "055a 444 285",
64+
"input": {
65+
"value": "055a 444 285"
66+
},
5167
"expected": false
5268
},
5369
{
5470
"description": "valid strings with punctuation included become invalid",
5571
"property": "valid",
56-
"input": "055-444-285",
72+
"input": {
73+
"value": "055-444-285"
74+
},
5775
"expected": false
5876
},
5977
{
6078
"description": "valid strings with symbols included become invalid",
6179
"property": "valid",
62-
"input": "055£ 444$ 285",
80+
"input": {
81+
"value": "055£ 444$ 285"
82+
},
6383
"expected": false
6484
},
6585
{
6686
"description": "single zero with space is invalid",
6787
"property": "valid",
68-
"input": " 0",
88+
"input": {
89+
"value": " 0"
90+
},
6991
"expected": false
7092
},
7193
{
7294
"description": "more than a single zero is valid",
7395
"property": "valid",
74-
"input": "0000 0",
96+
"input": {
97+
"value": "0000 0"
98+
},
7599
"expected": true
76100
},
77101
{
78102
"description": "input digit 9 is correctly converted to output digit 9",
79103
"property": "valid",
80-
"input": "091",
104+
"input": {
105+
"value": "091"
106+
},
81107
"expected": true
82108
}
83109
]

0 commit comments

Comments
 (0)