tracks/perl6/exercises/luhn/luhn.t in trackler-2.2.1.86 vs tracks/perl6/exercises/luhn/luhn.t in trackler-2.2.1.87
- old
+ new
@@ -21,11 +21,11 @@
require ::($module) <&is-luhn-valid>;
my $c-data = from-json $=pod.pop.contents;
for $c-data<cases>.values {
- given is-luhn-valid .<input> -> $result {
+ given is-luhn-valid .<input><value> -> $result {
subtest .<description>, {
plan 2;
isa-ok $result, Bool;
is-deeply $result, .<expected>, 'Result matches expected';
}
@@ -35,87 +35,113 @@
=head2 Canonical Data
=begin code
{
"exercise": "luhn",
- "version": "1.0.0",
+ "version": "1.1.0",
"cases": [
{
"description": "single digit strings can not be valid",
"property": "valid",
- "input": "1",
+ "input": {
+ "value": "1"
+ },
"expected": false
},
{
- "description": "A single zero is invalid",
+ "description": "a single zero is invalid",
"property": "valid",
- "input": "0",
+ "input": {
+ "value": "0"
+ },
"expected": false
},
{
"description": "a simple valid SIN that remains valid if reversed",
"property": "valid",
- "input": "059",
+ "input": {
+ "value": "059"
+ },
"expected": true
},
{
"description": "a simple valid SIN that becomes invalid if reversed",
"property": "valid",
- "input": "59",
+ "input": {
+ "value": "59"
+ },
"expected": true
},
{
"description": "a valid Canadian SIN",
"property": "valid",
- "input": "055 444 285",
+ "input": {
+ "value": "055 444 285"
+ },
"expected": true
},
{
"description": "invalid Canadian SIN",
"property": "valid",
- "input": "055 444 286",
+ "input": {
+ "value": "055 444 286"
+ },
"expected": false
},
{
"description": "invalid credit card",
"property": "valid",
- "input": "8273 1232 7352 0569",
+ "input": {
+ "value": "8273 1232 7352 0569"
+ },
"expected": false
},
{
"description": "valid strings with a non-digit included become invalid",
"property": "valid",
- "input": "055a 444 285",
+ "input": {
+ "value": "055a 444 285"
+ },
"expected": false
},
{
"description": "valid strings with punctuation included become invalid",
"property": "valid",
- "input": "055-444-285",
+ "input": {
+ "value": "055-444-285"
+ },
"expected": false
},
{
"description": "valid strings with symbols included become invalid",
"property": "valid",
- "input": "055£ 444$ 285",
+ "input": {
+ "value": "055£ 444$ 285"
+ },
"expected": false
},
{
"description": "single zero with space is invalid",
"property": "valid",
- "input": " 0",
+ "input": {
+ "value": " 0"
+ },
"expected": false
},
{
"description": "more than a single zero is valid",
"property": "valid",
- "input": "0000 0",
+ "input": {
+ "value": "0000 0"
+ },
"expected": true
},
{
"description": "input digit 9 is correctly converted to output digit 9",
"property": "valid",
- "input": "091",
+ "input": {
+ "value": "091"
+ },
"expected": true
}
]
}