Skip to content

Commit b0b7992

Browse files
authored
Updating tests for largest-series-product (#2592)
* Updating tests for largest-series-product * Updating proof solution
1 parent 2c66786 commit b0b7992

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

exercises/practice/largest-series-product/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
],
55
"contributors": [
66
"ankorGH",
7+
"jagdish-15",
78
"ovidiu141",
89
"petertseng",
910
"rchavarria",

exercises/practice/largest-series-product/.meta/proof.ci.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ export const largestProduct = (digits, seriesLength) => {
33
return 1;
44
}
55
if (seriesLength > digits.length) {
6-
throw new Error('Span must be smaller than string length');
6+
throw new Error('span must be smaller than string length');
77
}
88
if (seriesLength < 0) {
9-
throw new Error('Span must be greater than zero');
9+
throw new Error('span must not be negative');
1010
}
1111

1212
if (!/^[0-9]+$/g.test(digits)) {
13-
throw new Error('Digits input must only contain digits');
13+
throw new Error('digits input must only contain digits');
1414
}
1515

1616
let result = 0;

exercises/practice/largest-series-product/.meta/tests.toml

Lines changed: 15 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
[7c82f8b7-e347-48ee-8a22-f672323324d4]
613
description = "finds the largest product if span equals length"
@@ -48,3 +55,8 @@ description = "rejects invalid character in digits"
4855

4956
[5fe3c0e5-a945-49f2-b584-f0814b4dd1ef]
5057
description = "rejects negative span"
58+
include = false
59+
60+
[c859f34a-9bfe-4897-9c2f-6d7f8598e7f0]
61+
description = "rejects negative span"
62+
reimplements = "5fe3c0e5-a945-49f2-b584-f0814b4dd1ef"

exercises/practice/largest-series-product/largest-series-product.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@ describe('Largest Series Product', () => {
4242

4343
xtest('rejects span longer than string length', () => {
4444
expect(() => largestProduct('123', 4)).toThrow(
45-
new Error('Span must be smaller than string length'),
45+
new Error('span must be smaller than string length'),
4646
);
4747
});
4848

4949
xtest('rejects empty string and nonzero span', () => {
5050
expect(() => largestProduct('', 1)).toThrow(
51-
new Error('Span must be smaller than string length'),
51+
new Error('span must be smaller than string length'),
5252
);
5353
});
5454

5555
xtest('rejects invalid character in digits', () => {
5656
expect(() => largestProduct('1234a5', 2)).toThrow(
57-
new Error('Digits input must only contain digits'),
57+
new Error('digits input must only contain digits'),
5858
);
5959
});
6060

6161
xtest('rejects negative span', () => {
6262
expect(() => largestProduct('12345', -1)).toThrow(
63-
new Error('Span must be greater than zero'),
63+
new Error('span must not be negative'),
6464
);
6565
});
6666
});

0 commit comments

Comments
 (0)