Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

book-store: Add test that requires use of both groups of 4 and groups of 5 #1620

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion exercises/book-store/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"exercise": "book-store",
"version": "1.4.0",
"version": "1.5.0",
"cases": [
{
"description": "Return the total basket price after applying the best discount.",
Expand Down Expand Up @@ -147,6 +147,15 @@
"basket": [1,1,2,2,3,3,4,5,1,1,2,2,3,3,4,5]
},
"expected": 10240
},
{
"property": "total",
"description": "Two groups of four and a group of five",
"comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4,5]]. Solutions can pass all the other tests if they just try to group without using any groups of 5. This test case breaks that since it requires both 4-groups and 5-groups."],
"input": {
"basket": [1,1,1,2,2,2,3,3,3,4,4,5,5]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in my comment here, I would suggest shuffling the input numbers here (or adding an additional case that has the inputs shuffled), as this ensures a more robust solution.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've added a second test to check for that.

},
"expected": 8120
}
]
}
Expand Down