Skip to content

Commit e48964f

Browse files
authored
Update tests luhn (#2693)
* Sync toml file * Update test file * Configure config.json
1 parent e510590 commit e48964f

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

exercises/practice/luhn/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"contributors": [
66
"ankorGH",
77
"gabriel376",
8+
"jagdish-15",
89
"ovidiu141",
910
"rchavarria",
1011
"ryanplusplus",

exercises/practice/luhn/.meta/tests.toml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[792a7082-feb7-48c7-b88b-bbfec160865e]
613
description = "single digit strings can not be valid"
@@ -26,6 +33,9 @@ description = "invalid credit card"
2633
[20e67fad-2121-43ed-99a8-14b5b856adb9]
2734
description = "invalid long number with an even remainder"
2835

36+
[7e7c9fc1-d994-457c-811e-d390d52fba5e]
37+
description = "invalid long number with a remainder divisible by 5"
38+
2939
[ad2a0c5f-84ed-4e5b-95da-6011d6f4f0aa]
3040
description = "valid number with an even number of digits"
3141

@@ -50,8 +60,17 @@ description = "more than a single zero is valid"
5060
[ab56fa80-5de8-4735-8a4a-14dae588663e]
5161
description = "input digit 9 is correctly converted to output digit 9"
5262

63+
[b9887ee8-8337-46c5-bc45-3bcab51bc36f]
64+
description = "very long input is valid"
65+
66+
[8a7c0e24-85ea-4154-9cf1-c2db90eabc08]
67+
description = "valid luhn with an odd number of digits and non zero first digit"
68+
5369
[39a06a5a-5bad-4e0f-b215-b042d46209b1]
5470
description = "using ascii value for non-doubled non-digit isn't allowed"
5571

5672
[f94cf191-a62f-4868-bc72-7253114aa157]
5773
description = "using ascii value for doubled non-digit isn't allowed"
74+
75+
[8b72ad26-c8be-49a2-b99c-bcc3bf631b33]
76+
description = "non-numeric, non-space char in the middle with a sum that's divisible by 10 isn't allowed"

exercises/practice/luhn/luhn.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ describe('Luhn', () => {
3434
expect(valid('1 2345 6789 1234 5678 9012')).toEqual(false);
3535
});
3636

37+
xtest('invalid long number with a remainder divisible by 5', () => {
38+
expect(valid('1 2345 6789 1234 5678 9013')).toEqual(false);
39+
});
40+
3741
xtest('valid number with an even number of digits', () => {
3842
expect(valid('095 245 88')).toEqual(true);
3943
});
@@ -66,11 +70,23 @@ describe('Luhn', () => {
6670
expect(valid('091')).toEqual(true);
6771
});
6872

73+
xtest('very long input is valid', () => {
74+
expect(valid('9999999999 9999999999 9999999999 9999999999')).toEqual(true);
75+
});
76+
77+
xtest('valid luhn with an odd number of digits and non zero first digit', () => {
78+
expect(valid('109')).toEqual(true);
79+
});
80+
6981
xtest("using ascii value for non-doubled non-digit isn't allowed", () => {
7082
expect(valid('055b 444 285')).toEqual(false);
7183
});
7284

7385
xtest("using ascii value for doubled non-digit isn't allowed", () => {
7486
expect(valid(':9')).toEqual(false);
7587
});
88+
89+
xtest("non-numeric, non-space char in the middle with a sum that's divisible by 10 isn't allowed", () => {
90+
expect(valid('59%59')).toEqual(false);
91+
});
7692
});

0 commit comments

Comments
 (0)