From f51a8b217908ff07f40f3f79749b66240d3c0cc4 Mon Sep 17 00:00:00 2001 From: Scott Swingle Date: Sat, 23 Nov 2019 18:57:09 -0800 Subject: [PATCH 1/2] add test for book store that requires use of 4 and 5 groups --- exercises/book-store/canonical-data.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/exercises/book-store/canonical-data.json b/exercises/book-store/canonical-data.json index 72dd54b26a..96a04ec89f 100644 --- a/exercises/book-store/canonical-data.json +++ b/exercises/book-store/canonical-data.json @@ -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.", @@ -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] + }, + "expected": 8120 } ] } From d02c142fe8fd985294f39615798d49f5eeaea3cc Mon Sep 17 00:00:00 2001 From: Scott Swingle Date: Mon, 25 Nov 2019 18:42:49 -0800 Subject: [PATCH 2/2] add test for book store that gives books in shuffled order --- exercises/book-store/canonical-data.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exercises/book-store/canonical-data.json b/exercises/book-store/canonical-data.json index 96a04ec89f..3eace29358 100644 --- a/exercises/book-store/canonical-data.json +++ b/exercises/book-store/canonical-data.json @@ -156,6 +156,15 @@ "basket": [1,1,1,2,2,2,3,3,3,4,4,5,5] }, "expected": 8120 + }, + { + "property": "total", + "description": "shuffled book order", + "comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4,5]]. All the other tests give the books in sorted order. Robust solutions should be able to handle any order"], + "input": { + "basket": [1,2,3,4,5,1,2,3,4,5,1,2,3] + }, + "expected": 8120 } ] }