trackler 2.2.1.86 → 2.2.1.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/reverse-string/metadata.yml +0 -1
- data/tracks/bash/CONTRIBUTING.md +129 -28
- data/tracks/bash/config/exercise_readme.go.tmpl +10 -4
- data/tracks/bash/exercises/acronym/README.md +8 -11
- data/tracks/bash/exercises/acronym/{acronym_tests.sh → acronym_test.sh} +0 -0
- data/tracks/bash/exercises/anagram/README.md +6 -1
- data/tracks/bash/exercises/anagram/anagram_test.sh +1 -1
- data/tracks/bash/exercises/armstrong-numbers/README.md +10 -2
- data/tracks/bash/exercises/atbash-cipher/README.md +6 -6
- data/tracks/bash/exercises/bob/README.md +8 -1
- data/tracks/bash/exercises/collatz-conjecture/README.md +11 -2
- data/tracks/bash/exercises/collatz-conjecture/{collatz_test.sh → collatz_conjecture_test.sh} +6 -6
- data/tracks/bash/exercises/difference-of-squares/README.md +6 -1
- data/tracks/bash/exercises/error-handling/README.md +13 -5
- data/tracks/bash/exercises/error-handling/error_handling_test.sh +18 -22
- data/tracks/bash/exercises/error-handling/example.sh +7 -6
- data/tracks/bash/exercises/gigasecond/.meta/hints.md +0 -5
- data/tracks/bash/exercises/gigasecond/README.md +36 -1
- data/tracks/bash/exercises/grains/README.md +10 -2
- data/tracks/bash/exercises/hamming/README.md +6 -1
- data/tracks/bash/exercises/hello-world/README.md +7 -2
- data/tracks/bash/exercises/leap/README.md +7 -2
- data/tracks/bash/exercises/luhn/README.md +7 -2
- data/tracks/bash/exercises/nucleotide-count/README.md +13 -22
- data/tracks/bash/exercises/pangram/README.md +7 -2
- data/tracks/bash/exercises/phone-number/README.md +10 -4
- data/tracks/bash/exercises/raindrops/README.md +6 -1
- data/tracks/bash/exercises/reverse-string/README.md +11 -2
- data/tracks/bash/exercises/rna-transcription/README.md +7 -2
- data/tracks/bash/exercises/roman-numerals/README.md +11 -2
- data/tracks/bash/exercises/triangle/README.md +5 -4
- data/tracks/bash/exercises/two-fer/README.md +7 -9
- data/tracks/bash/exercises/word-count/README.md +6 -2
- data/tracks/bash/exercises/word-count/example.sh +22 -13
- data/tracks/bash/scripts/canonical_data_check.sh +112 -0
- data/tracks/c/exercises/acronym/src/{example.h → acronym.h} +0 -0
- data/tracks/c/exercises/gigasecond/.meta/hints.md +124 -0
- data/tracks/c/exercises/gigasecond/README.md +126 -0
- data/tracks/c/exercises/isogram/src/{example.h → isogram.h} +0 -0
- data/tracks/c/exercises/meetup/.meta/hints.md +124 -0
- data/tracks/c/exercises/meetup/README.md +142 -12
- data/tracks/c/exercises/pangram/src/{example.h → pangram.h} +0 -0
- data/tracks/c/exercises/space-age/.meta/hints.md +124 -0
- data/tracks/c/exercises/space-age/README.md +127 -2
- data/tracks/elisp/bin/test-examples +11 -14
- data/tracks/elisp/config.json +9 -1
- data/tracks/elisp/exercises/acronym/README.md +13 -0
- data/tracks/elisp/exercises/acronym/acronym-test.el +28 -0
- data/tracks/elisp/exercises/acronym/acronym.el +11 -0
- data/tracks/elisp/exercises/acronym/example.el +14 -0
- data/tracks/elisp/exercises/bob/example.el +1 -3
- data/tracks/elisp/exercises/hamming/README.md +2 -0
- data/tracks/elisp/exercises/hamming/hamming-test.el +35 -12
- data/tracks/elisp/exercises/hamming/hamming.el +0 -3
- data/tracks/fsharp/exercises/custom-set/CustomSetTest.fs +206 -132
- data/tracks/fsharp/exercises/custom-set/Example.fs +2 -0
- data/tracks/fsharp/generators/Generators.fs +61 -0
- data/tracks/go/config.json +25 -2
- data/tracks/go/exercises/acronym/acronym_test.go +8 -0
- data/tracks/go/exercises/alphametics/.meta/gen.go +72 -0
- data/tracks/go/exercises/alphametics/.meta/hints.md +38 -0
- data/tracks/go/exercises/alphametics/README.md +93 -0
- data/tracks/go/exercises/alphametics/alphametics_test.go +33 -0
- data/tracks/go/exercises/alphametics/cases_test.go +59 -0
- data/tracks/go/exercises/alphametics/example.go +212 -0
- data/tracks/go/exercises/atbash-cipher/.meta/gen.go +6 -4
- data/tracks/go/exercises/atbash-cipher/cases_test.go +2 -2
- data/tracks/go/exercises/change/.meta/gen.go +7 -5
- data/tracks/go/exercises/change/cases_test.go +2 -2
- data/tracks/go/exercises/collatz-conjecture/.meta/gen.go +5 -3
- data/tracks/go/exercises/collatz-conjecture/cases_test.go +2 -2
- data/tracks/go/exercises/connect/.meta/gen.go +5 -3
- data/tracks/go/exercises/connect/cases_test.go +2 -2
- data/tracks/go/exercises/flatten-array/.meta/gen.go +5 -3
- data/tracks/go/exercises/flatten-array/cases_test.go +2 -2
- data/tracks/go/exercises/meetup/.meta/gen.go +19 -8
- data/tracks/go/exercises/meetup/cases_test.go +2 -2
- data/tracks/go/exercises/simple-linked-list/README.md +47 -0
- data/tracks/go/exercises/simple-linked-list/example.go +74 -0
- data/tracks/go/exercises/simple-linked-list/linked_list_test.go +210 -0
- data/tracks/idris/config.json +2 -2
- data/tracks/java/exercises/all-your-base/.meta/src/reference/java/BaseConverter.java +1 -5
- data/tracks/java/exercises/all-your-base/.meta/version +1 -1
- data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +34 -10
- data/tracks/java/exercises/bob/README.md +2 -0
- data/tracks/java/exercises/kindergarten-garden/.meta/version +1 -0
- data/tracks/java/exercises/kindergarten-garden/src/test/java/KindergartenGardenTest.java +0 -55
- data/tracks/java/exercises/meetup/.meta/version +1 -0
- data/tracks/java/exercises/meetup/src/test/java/MeetupTest.java +32 -0
- data/tracks/java/exercises/parallel-letter-frequency/README.md +1 -0
- data/tracks/java/exercises/proverb/README.md +16 -10
- data/tracks/java/exercises/rail-fence-cipher/README.md +5 -6
- data/tracks/java/exercises/two-fer/README.md +1 -1
- data/tracks/java/exercises/word-search/.meta/version +1 -1
- data/tracks/java/exercises/word-search/src/test/java/WordSearcherTest.java +240 -2
- data/tracks/javascript/.eslintignore +0 -1
- data/tracks/javascript/exercises/palindrome-products/example.js +3 -3
- data/tracks/kotlin/docs/INSTALLATION.md +77 -68
- data/tracks/kotlin/docs/TESTS.md +41 -39
- data/tracks/perl6/exercises/acronym/acronym.t +20 -8
- data/tracks/perl6/exercises/acronym/example.yaml +1 -1
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +108 -66
- data/tracks/perl6/exercises/all-your-base/example.yaml +2 -2
- data/tracks/perl6/exercises/allergies/allergies.t +39 -15
- data/tracks/perl6/exercises/allergies/example.yaml +2 -2
- data/tracks/perl6/exercises/anagram/anagram.t +73 -40
- data/tracks/perl6/exercises/anagram/example.yaml +1 -1
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +38 -15
- data/tracks/perl6/exercises/atbash-cipher/example.yaml +1 -1
- data/tracks/perl6/exercises/bob/bob.t +77 -27
- data/tracks/perl6/exercises/bob/example.yaml +1 -1
- data/tracks/perl6/exercises/flatten-array/example.yaml +1 -1
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +20 -8
- data/tracks/perl6/exercises/luhn/example.yaml +1 -1
- data/tracks/perl6/exercises/luhn/luhn.t +42 -16
- data/tracks/perl6/exercises/roman-numerals/README.md +68 -0
- data/tracks/php/exercises/gigasecond/gigasecond_test.php +1 -1
- data/tracks/python/docs/ABOUT.md +2 -2
- metadata +27 -10
- data/tracks/bash/docs/EXERCISE_README_INSERT.md +0 -3
- data/tracks/bash/exercises/word-count/example.awk +0 -12
- data/tracks/java/exercises/alphametics/src/main/java/.keep +0 -0
|
@@ -3,7 +3,7 @@ version: 1
|
|
|
3
3
|
plan: 14
|
|
4
4
|
imports: '&encode &decode'
|
|
5
5
|
tests: |-
|
|
6
|
-
is .<phrase>.&::(.<property>), |.<expected description> for $c-data<cases>»<cases>».Array.flat;
|
|
6
|
+
is .<input><phrase>.&::(.<property>), |.<expected description> for $c-data<cases>»<cases>».Array.flat;
|
|
7
7
|
|
|
8
8
|
unit: module
|
|
9
9
|
example: |-
|
|
@@ -30,163 +30,213 @@ subtest 'Class methods', {
|
|
|
30
30
|
|
|
31
31
|
my $c-data = from-json $=pod.pop.contents;
|
|
32
32
|
# Go through the cases and check that Bob gives us the correct responses.
|
|
33
|
-
is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
|
|
33
|
+
is ::($exercise).?hey(.<input><heyBob>), |.<expected description> for @($c-data<cases>);
|
|
34
34
|
|
|
35
35
|
=head2 Canonical Data
|
|
36
36
|
=begin code
|
|
37
37
|
|
|
38
38
|
{
|
|
39
39
|
"exercise": "bob",
|
|
40
|
-
"version": "1.
|
|
40
|
+
"version": "1.2.0",
|
|
41
41
|
"cases": [
|
|
42
42
|
{
|
|
43
43
|
"description": "stating something",
|
|
44
44
|
"property": "response",
|
|
45
|
-
"input":
|
|
45
|
+
"input": {
|
|
46
|
+
"heyBob": "Tom-ay-to, tom-aaaah-to."
|
|
47
|
+
},
|
|
46
48
|
"expected": "Whatever."
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
51
|
"description": "shouting",
|
|
50
52
|
"property": "response",
|
|
51
|
-
"input":
|
|
53
|
+
"input": {
|
|
54
|
+
"heyBob": "WATCH OUT!"
|
|
55
|
+
},
|
|
52
56
|
"expected": "Whoa, chill out!"
|
|
53
57
|
},
|
|
54
58
|
{
|
|
55
59
|
"description": "shouting gibberish",
|
|
56
60
|
"property": "response",
|
|
57
|
-
"input":
|
|
61
|
+
"input": {
|
|
62
|
+
"heyBob": "FCECDFCAAB"
|
|
63
|
+
},
|
|
58
64
|
"expected": "Whoa, chill out!"
|
|
59
65
|
},
|
|
60
66
|
{
|
|
61
67
|
"description": "asking a question",
|
|
62
68
|
"property": "response",
|
|
63
|
-
"input":
|
|
69
|
+
"input": {
|
|
70
|
+
"heyBob": "Does this cryogenic chamber make me look fat?"
|
|
71
|
+
},
|
|
64
72
|
"expected": "Sure."
|
|
65
73
|
},
|
|
66
74
|
{
|
|
67
75
|
"description": "asking a numeric question",
|
|
68
76
|
"property": "response",
|
|
69
|
-
"input":
|
|
77
|
+
"input": {
|
|
78
|
+
"heyBob": "You are, what, like 15?"
|
|
79
|
+
},
|
|
70
80
|
"expected": "Sure."
|
|
71
81
|
},
|
|
72
82
|
{
|
|
73
83
|
"description": "asking gibberish",
|
|
74
84
|
"property": "response",
|
|
75
|
-
"input":
|
|
85
|
+
"input": {
|
|
86
|
+
"heyBob": "fffbbcbeab?"
|
|
87
|
+
},
|
|
76
88
|
"expected": "Sure."
|
|
77
89
|
},
|
|
78
90
|
{
|
|
79
91
|
"description": "talking forcefully",
|
|
80
92
|
"property": "response",
|
|
81
|
-
"input":
|
|
93
|
+
"input": {
|
|
94
|
+
"heyBob": "Let's go make out behind the gym!"
|
|
95
|
+
},
|
|
82
96
|
"expected": "Whatever."
|
|
83
97
|
},
|
|
84
98
|
{
|
|
85
99
|
"description": "using acronyms in regular speech",
|
|
86
100
|
"property": "response",
|
|
87
|
-
"input":
|
|
101
|
+
"input": {
|
|
102
|
+
"heyBob": "It's OK if you don't want to go to the DMV."
|
|
103
|
+
},
|
|
88
104
|
"expected": "Whatever."
|
|
89
105
|
},
|
|
90
106
|
{
|
|
91
107
|
"description": "forceful question",
|
|
92
108
|
"property": "response",
|
|
93
|
-
"input":
|
|
109
|
+
"input": {
|
|
110
|
+
"heyBob": "WHAT THE HELL WERE YOU THINKING?"
|
|
111
|
+
},
|
|
94
112
|
"expected": "Calm down, I know what I'm doing!"
|
|
95
113
|
},
|
|
96
114
|
{
|
|
97
115
|
"description": "shouting numbers",
|
|
98
116
|
"property": "response",
|
|
99
|
-
"input":
|
|
117
|
+
"input": {
|
|
118
|
+
"heyBob": "1, 2, 3 GO!"
|
|
119
|
+
},
|
|
100
120
|
"expected": "Whoa, chill out!"
|
|
101
121
|
},
|
|
102
122
|
{
|
|
103
123
|
"description": "only numbers",
|
|
104
124
|
"property": "response",
|
|
105
|
-
"input":
|
|
125
|
+
"input": {
|
|
126
|
+
"heyBob": "1, 2, 3"
|
|
127
|
+
},
|
|
106
128
|
"expected": "Whatever."
|
|
107
129
|
},
|
|
108
130
|
{
|
|
109
131
|
"description": "question with only numbers",
|
|
110
132
|
"property": "response",
|
|
111
|
-
"input":
|
|
133
|
+
"input": {
|
|
134
|
+
"heyBob": "4?"
|
|
135
|
+
},
|
|
112
136
|
"expected": "Sure."
|
|
113
137
|
},
|
|
114
138
|
{
|
|
115
139
|
"description": "shouting with special characters",
|
|
116
140
|
"property": "response",
|
|
117
|
-
"input":
|
|
141
|
+
"input": {
|
|
142
|
+
"heyBob": "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"
|
|
143
|
+
},
|
|
118
144
|
"expected": "Whoa, chill out!"
|
|
119
145
|
},
|
|
120
146
|
{
|
|
121
147
|
"description": "shouting with no exclamation mark",
|
|
122
148
|
"property": "response",
|
|
123
|
-
"input":
|
|
149
|
+
"input": {
|
|
150
|
+
"heyBob": "I HATE YOU"
|
|
151
|
+
},
|
|
124
152
|
"expected": "Whoa, chill out!"
|
|
125
153
|
},
|
|
126
154
|
{
|
|
127
155
|
"description": "statement containing question mark",
|
|
128
156
|
"property": "response",
|
|
129
|
-
"input":
|
|
157
|
+
"input": {
|
|
158
|
+
"heyBob": "Ending with ? means a question."
|
|
159
|
+
},
|
|
130
160
|
"expected": "Whatever."
|
|
131
161
|
},
|
|
132
162
|
{
|
|
133
163
|
"description": "non-letters with question",
|
|
134
164
|
"property": "response",
|
|
135
|
-
"input":
|
|
165
|
+
"input": {
|
|
166
|
+
"heyBob": ":) ?"
|
|
167
|
+
},
|
|
136
168
|
"expected": "Sure."
|
|
137
169
|
},
|
|
138
170
|
{
|
|
139
171
|
"description": "prattling on",
|
|
140
172
|
"property": "response",
|
|
141
|
-
"input":
|
|
173
|
+
"input": {
|
|
174
|
+
"heyBob": "Wait! Hang on. Are you going to be OK?"
|
|
175
|
+
},
|
|
142
176
|
"expected": "Sure."
|
|
143
177
|
},
|
|
144
178
|
{
|
|
145
179
|
"description": "silence",
|
|
146
180
|
"property": "response",
|
|
147
|
-
"input":
|
|
181
|
+
"input": {
|
|
182
|
+
"heyBob": ""
|
|
183
|
+
},
|
|
148
184
|
"expected": "Fine. Be that way!"
|
|
149
185
|
},
|
|
150
186
|
{
|
|
151
187
|
"description": "prolonged silence",
|
|
152
188
|
"property": "response",
|
|
153
|
-
"input":
|
|
189
|
+
"input": {
|
|
190
|
+
"heyBob": " "
|
|
191
|
+
},
|
|
154
192
|
"expected": "Fine. Be that way!"
|
|
155
193
|
},
|
|
156
194
|
{
|
|
157
195
|
"description": "alternate silence",
|
|
158
196
|
"property": "response",
|
|
159
|
-
"input":
|
|
197
|
+
"input": {
|
|
198
|
+
"heyBob": "\t\t\t\t\t\t\t\t\t\t"
|
|
199
|
+
},
|
|
160
200
|
"expected": "Fine. Be that way!"
|
|
161
201
|
},
|
|
162
202
|
{
|
|
163
203
|
"description": "multiple line question",
|
|
164
204
|
"property": "response",
|
|
165
|
-
"input":
|
|
205
|
+
"input": {
|
|
206
|
+
"heyBob": "\nDoes this cryogenic chamber make me look fat?\nno"
|
|
207
|
+
},
|
|
166
208
|
"expected": "Whatever."
|
|
167
209
|
},
|
|
168
210
|
{
|
|
169
211
|
"description": "starting with whitespace",
|
|
170
212
|
"property": "response",
|
|
171
|
-
"input":
|
|
213
|
+
"input": {
|
|
214
|
+
"heyBob": " hmmmmmmm..."
|
|
215
|
+
},
|
|
172
216
|
"expected": "Whatever."
|
|
173
217
|
},
|
|
174
218
|
{
|
|
175
219
|
"description": "ending with whitespace",
|
|
176
220
|
"property": "response",
|
|
177
|
-
"input":
|
|
221
|
+
"input": {
|
|
222
|
+
"heyBob": "Okay if like my spacebar quite a bit? "
|
|
223
|
+
},
|
|
178
224
|
"expected": "Sure."
|
|
179
225
|
},
|
|
180
226
|
{
|
|
181
227
|
"description": "other whitespace",
|
|
182
228
|
"property": "response",
|
|
183
|
-
"input":
|
|
229
|
+
"input": {
|
|
230
|
+
"heyBob": "\n\r \t"
|
|
231
|
+
},
|
|
184
232
|
"expected": "Fine. Be that way!"
|
|
185
233
|
},
|
|
186
234
|
{
|
|
187
235
|
"description": "non-question ending with whitespace",
|
|
188
236
|
"property": "response",
|
|
189
|
-
"input":
|
|
237
|
+
"input": {
|
|
238
|
+
"heyBob": "This is a statement ending with whitespace "
|
|
239
|
+
},
|
|
190
240
|
"expected": "Whatever."
|
|
191
241
|
}
|
|
192
242
|
]
|
|
@@ -4,7 +4,7 @@ plan: 28
|
|
|
4
4
|
methods: hey
|
|
5
5
|
tests: |-
|
|
6
6
|
# Go through the cases and check that Bob gives us the correct responses.
|
|
7
|
-
is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
|
|
7
|
+
is ::($exercise).?hey(.<input><heyBob>), |.<expected description> for @($c-data<cases>);
|
|
8
8
|
|
|
9
9
|
exercise_comment: The name of this exercise.
|
|
10
10
|
module_comment: The name of the module file to be loaded.
|
|
@@ -3,7 +3,7 @@ version: 1
|
|
|
3
3
|
plan: 8
|
|
4
4
|
imports: '&flatten-array'
|
|
5
5
|
tests: |-
|
|
6
|
-
is-deeply flatten-array(.<input>), |.<expected description> for @($c-data<cases>);
|
|
6
|
+
is-deeply flatten-array(.<input><array>), |.<expected description> for @($c-data<cases>);
|
|
7
7
|
|
|
8
8
|
unit: module
|
|
9
9
|
example: |-
|
|
@@ -22,49 +22,61 @@ if ::($exercise).^ver !~~ $version {
|
|
|
22
22
|
require ::($module) <&flatten-array>;
|
|
23
23
|
|
|
24
24
|
my $c-data = from-json $=pod.pop.contents;
|
|
25
|
-
is-deeply flatten-array(.<input>), |.<expected description> for @($c-data<cases>);
|
|
25
|
+
is-deeply flatten-array(.<input><array>), |.<expected description> for @($c-data<cases>);
|
|
26
26
|
|
|
27
27
|
=head2 Canonical Data
|
|
28
28
|
=begin code
|
|
29
29
|
|
|
30
30
|
{
|
|
31
31
|
"exercise": "flatten-array",
|
|
32
|
-
"version": "1.
|
|
32
|
+
"version": "1.2.0",
|
|
33
33
|
"cases": [
|
|
34
34
|
{
|
|
35
35
|
"description": "no nesting",
|
|
36
36
|
"property": "flatten",
|
|
37
|
-
"input":
|
|
37
|
+
"input": {
|
|
38
|
+
"array": [0, 1, 2]
|
|
39
|
+
},
|
|
38
40
|
"expected": [0, 1, 2]
|
|
39
41
|
},
|
|
40
42
|
{
|
|
41
43
|
"description": "flattens array with just integers present",
|
|
42
44
|
"property": "flatten",
|
|
43
|
-
"input":
|
|
45
|
+
"input": {
|
|
46
|
+
"array": [1, [2, 3, 4, 5, 6, 7], 8]
|
|
47
|
+
},
|
|
44
48
|
"expected": [1, 2, 3, 4, 5, 6, 7, 8]
|
|
45
49
|
},
|
|
46
50
|
{
|
|
47
51
|
"description": "5 level nesting",
|
|
48
52
|
"property": "flatten",
|
|
49
|
-
"input":
|
|
53
|
+
"input": {
|
|
54
|
+
"array": [0, 2, [[2, 3], 8, 100, 4, [[[50]]]], -2]
|
|
55
|
+
},
|
|
50
56
|
"expected": [0, 2, 2, 3, 8, 100, 4, 50, -2]
|
|
51
57
|
},
|
|
52
58
|
{
|
|
53
59
|
"description": "6 level nesting",
|
|
54
60
|
"property": "flatten",
|
|
55
|
-
"input":
|
|
61
|
+
"input": {
|
|
62
|
+
"array": [1, [2, [[3]], [4, [[5]]], 6, 7], 8]
|
|
63
|
+
},
|
|
56
64
|
"expected": [1, 2, 3, 4, 5, 6, 7, 8]
|
|
57
65
|
},
|
|
58
66
|
{
|
|
59
67
|
"description": "6 level nest list with null values",
|
|
60
68
|
"property": "flatten",
|
|
61
|
-
"input":
|
|
69
|
+
"input": {
|
|
70
|
+
"array": [0, 2, [[2, 3], 8, [[100]], null, [[null]]], -2]
|
|
71
|
+
},
|
|
62
72
|
"expected": [0, 2, 2, 3, 8, 100, -2]
|
|
63
73
|
},
|
|
64
74
|
{
|
|
65
75
|
"description": "all values in nested list are null",
|
|
66
76
|
"property": "flatten",
|
|
67
|
-
"input":
|
|
77
|
+
"input": {
|
|
78
|
+
"array": [null, [[[null]]], null, null, [[null, null], null], null]
|
|
79
|
+
},
|
|
68
80
|
"expected": []
|
|
69
81
|
}
|
|
70
82
|
]
|
|
@@ -23,7 +23,7 @@ require ::($module) <&is-luhn-valid>;
|
|
|
23
23
|
|
|
24
24
|
my $c-data = from-json $=pod.pop.contents;
|
|
25
25
|
for $c-data<cases>.values {
|
|
26
|
-
given is-luhn-valid .<input> -> $result {
|
|
26
|
+
given is-luhn-valid .<input><value> -> $result {
|
|
27
27
|
subtest .<description>, {
|
|
28
28
|
plan 2;
|
|
29
29
|
isa-ok $result, Bool;
|
|
@@ -37,84 +37,110 @@ for $c-data<cases>.values {
|
|
|
37
37
|
|
|
38
38
|
{
|
|
39
39
|
"exercise": "luhn",
|
|
40
|
-
"version": "1.
|
|
40
|
+
"version": "1.1.0",
|
|
41
41
|
"cases": [
|
|
42
42
|
{
|
|
43
43
|
"description": "single digit strings can not be valid",
|
|
44
44
|
"property": "valid",
|
|
45
|
-
"input":
|
|
45
|
+
"input": {
|
|
46
|
+
"value": "1"
|
|
47
|
+
},
|
|
46
48
|
"expected": false
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
|
-
"description": "
|
|
51
|
+
"description": "a single zero is invalid",
|
|
50
52
|
"property": "valid",
|
|
51
|
-
"input":
|
|
53
|
+
"input": {
|
|
54
|
+
"value": "0"
|
|
55
|
+
},
|
|
52
56
|
"expected": false
|
|
53
57
|
},
|
|
54
58
|
{
|
|
55
59
|
"description": "a simple valid SIN that remains valid if reversed",
|
|
56
60
|
"property": "valid",
|
|
57
|
-
"input":
|
|
61
|
+
"input": {
|
|
62
|
+
"value": "059"
|
|
63
|
+
},
|
|
58
64
|
"expected": true
|
|
59
65
|
},
|
|
60
66
|
{
|
|
61
67
|
"description": "a simple valid SIN that becomes invalid if reversed",
|
|
62
68
|
"property": "valid",
|
|
63
|
-
"input":
|
|
69
|
+
"input": {
|
|
70
|
+
"value": "59"
|
|
71
|
+
},
|
|
64
72
|
"expected": true
|
|
65
73
|
},
|
|
66
74
|
{
|
|
67
75
|
"description": "a valid Canadian SIN",
|
|
68
76
|
"property": "valid",
|
|
69
|
-
"input":
|
|
77
|
+
"input": {
|
|
78
|
+
"value": "055 444 285"
|
|
79
|
+
},
|
|
70
80
|
"expected": true
|
|
71
81
|
},
|
|
72
82
|
{
|
|
73
83
|
"description": "invalid Canadian SIN",
|
|
74
84
|
"property": "valid",
|
|
75
|
-
"input":
|
|
85
|
+
"input": {
|
|
86
|
+
"value": "055 444 286"
|
|
87
|
+
},
|
|
76
88
|
"expected": false
|
|
77
89
|
},
|
|
78
90
|
{
|
|
79
91
|
"description": "invalid credit card",
|
|
80
92
|
"property": "valid",
|
|
81
|
-
"input":
|
|
93
|
+
"input": {
|
|
94
|
+
"value": "8273 1232 7352 0569"
|
|
95
|
+
},
|
|
82
96
|
"expected": false
|
|
83
97
|
},
|
|
84
98
|
{
|
|
85
99
|
"description": "valid strings with a non-digit included become invalid",
|
|
86
100
|
"property": "valid",
|
|
87
|
-
"input":
|
|
101
|
+
"input": {
|
|
102
|
+
"value": "055a 444 285"
|
|
103
|
+
},
|
|
88
104
|
"expected": false
|
|
89
105
|
},
|
|
90
106
|
{
|
|
91
107
|
"description": "valid strings with punctuation included become invalid",
|
|
92
108
|
"property": "valid",
|
|
93
|
-
"input":
|
|
109
|
+
"input": {
|
|
110
|
+
"value": "055-444-285"
|
|
111
|
+
},
|
|
94
112
|
"expected": false
|
|
95
113
|
},
|
|
96
114
|
{
|
|
97
115
|
"description": "valid strings with symbols included become invalid",
|
|
98
116
|
"property": "valid",
|
|
99
|
-
"input":
|
|
117
|
+
"input": {
|
|
118
|
+
"value": "055£ 444$ 285"
|
|
119
|
+
},
|
|
100
120
|
"expected": false
|
|
101
121
|
},
|
|
102
122
|
{
|
|
103
123
|
"description": "single zero with space is invalid",
|
|
104
124
|
"property": "valid",
|
|
105
|
-
"input":
|
|
125
|
+
"input": {
|
|
126
|
+
"value": " 0"
|
|
127
|
+
},
|
|
106
128
|
"expected": false
|
|
107
129
|
},
|
|
108
130
|
{
|
|
109
131
|
"description": "more than a single zero is valid",
|
|
110
132
|
"property": "valid",
|
|
111
|
-
"input":
|
|
133
|
+
"input": {
|
|
134
|
+
"value": "0000 0"
|
|
135
|
+
},
|
|
112
136
|
"expected": true
|
|
113
137
|
},
|
|
114
138
|
{
|
|
115
139
|
"description": "input digit 9 is correctly converted to output digit 9",
|
|
116
140
|
"property": "valid",
|
|
117
|
-
"input":
|
|
141
|
+
"input": {
|
|
142
|
+
"value": "091"
|
|
143
|
+
},
|
|
118
144
|
"expected": true
|
|
119
145
|
}
|
|
120
146
|
]
|