Skip to content

Commit a1bf7e3

Browse files
authored
Luhn: Update tests to 1.7.0 (1 changed tests, 2 new tests) (#900)
Changes included: 1. exercism/problem-specifications#1480: 1.4.0 to 1.5.0: Change "055a 444 285" test into "055b 444 285" for subtle reasons. New test name: using ascii value for doubled non-digit isn't allowed 2. exercism/problem-specifications#1500: 1.5.0 to 1.6.0: Add test case: valid number with an odd number of spaces 3. exercism/problem-specifications#1635: 1.6.0 to 1.7.0: Add test case: invalid long number with an even remainder
1 parent 68e1aab commit a1bf7e3

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

exercises/luhn/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: luhn
2-
version: 1.3.0.6
2+
version: 1.7.0.7
33

44
dependencies:
55
- base

exercises/luhn/test/Tests.hs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,22 @@ cases = [ Case { description = "single digit strings can not be valid"
4848
, input = "8273 1232 7352 0569"
4949
, expected = False
5050
}
51+
, Case { description = "invalid long number with an even remainder"
52+
, input = "1 2345 6789 1234 5678 9012"
53+
, expected = False
54+
}
5155
, Case { description = "valid number with an even number of digits"
5256
, input = "095 245 88"
5357
, expected = True
5458
}
59+
, Case { description = "valid number with an odd number of spaces"
60+
, input = "234 567 891 234"
61+
, expected = True
62+
}
5563
-- This track is not testing these cases, since we would rather focus on the algorithm,
5664
-- and because it seems strange to be unable to distinguish between well-formed invalid input and malformed input.
57-
-- , Case { description = "valid strings with a non-digit included become invalid"
58-
-- , input = "055a 444 285"
65+
-- , Case { description = "valid strings with a non-digit added at the end become invalid"
66+
-- , input = "059a"
5967
-- , expected = False
6068
-- }
6169
-- , Case { description = "valid strings with punctuation included become invalid"
@@ -78,7 +86,11 @@ cases = [ Case { description = "single digit strings can not be valid"
7886
, input = "091"
7987
, expected = True
8088
}
81-
-- , Case { description = "strings with non-digits is invalid"
89+
-- , Case { description = "using ascii value for non-doubled non-digit isn't allowed"
90+
-- , input = "055b 444 285"
91+
-- , expected = False
92+
-- }
93+
-- , Case { description = "using ascii value for doubled non-digit isn't allowed"
8294
-- , input = ":9"
8395
-- , expected = False
8496
-- }

0 commit comments

Comments
 (0)