Skip to content

Commit 98c621a

Browse files
authored
Updating tests for change (#2578)
1 parent 8758c83 commit 98c621a

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

exercises/practice/change/.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
"adamxtokyo",
7+
"jagdish-15",
78
"rchavarria",
89
"SleeplessByte",
910
"tejasbubane",

exercises/practice/change/.meta/tests.toml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
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.
11+
12+
[d0ebd0e1-9d27-4609-a654-df5c0ba1d83a]
13+
description = "change for 1 cent"
414

515
[36887bea-7f92-4a9c-b0cc-c0e886b3ecc8]
616
description = "single coin change"
@@ -23,6 +33,9 @@ description = "possible change without unit coins available"
2333
[9a166411-d35d-4f7f-a007-6724ac266178]
2434
description = "another possible change without unit coins available"
2535

36+
[ce0f80d5-51c3-469d-818c-3e69dbd25f75]
37+
description = "a greedy approach is not optimal"
38+
2639
[bbbcc154-e9e9-4209-a4db-dd6d81ec26bb]
2740
description = "no coins make 0 change"
2841

exercises/practice/change/change.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ describe('Change', () => {
5454
expect(result).toEqual([4, 4, 4, 5, 5, 5]);
5555
});
5656

57+
xtest('a greedy approach is not optimal', () => {
58+
const change = new Change();
59+
const result = change.calculate([1, 10, 11], 20);
60+
expect(result).toEqual([10, 10]);
61+
});
62+
5763
xtest('no coins make 0 change', () => {
5864
const change = new Change();
5965
const result = change.calculate([1, 5, 10, 21, 25], 0);

0 commit comments

Comments
 (0)