-
-
Notifications
You must be signed in to change notification settings - Fork 551
/
Copy pathcanonical-data.json
172 lines (172 loc) · 5.66 KB
/
canonical-data.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
{
"exercise": "book-store",
"version": "1.5.0",
"cases": [
{
"description": "Return the total basket price after applying the best discount.",
"comments": [
"Calculate lowest price for a shopping basket containing books only from ",
"a single series. There is no discount advantage for having more than ",
"one copy of any single book in a grouping.",
"implementors should use proper fixed-point or currency data types of the ",
"corresponding language and not float.",
"All 'expected' amounts are in cents."
],
"cases": [
{
"property": "total",
"description": "Only a single book",
"comments": ["Suggested grouping, [[1]]."],
"input": {
"basket": [1]
},
"expected": 800
},
{
"property": "total",
"description": "Two of the same book",
"comments": ["Suggested grouping, [[2],[2]]."],
"input": {
"basket": [2,2]
},
"expected": 1600
},
{
"property": "total",
"description": "Empty basket",
"comments": ["Suggested grouping, []."],
"input": {
"basket": []
},
"expected": 0
},
{
"property": "total",
"description": "Two different books",
"comments": ["Suggested grouping, [[1,2]]."],
"input": {
"basket": [1,2]
},
"expected": 1520
},
{
"property": "total",
"description": "Three different books",
"comments": ["Suggested grouping, [[1,2,3]]."],
"input": {
"basket": [1,2,3]
},
"expected": 2160
},
{
"property": "total",
"description": "Four different books",
"comments": ["Suggested grouping, [[1,2,3,4]]."],
"input": {
"basket": [1,2,3,4]
},
"expected": 2560
},
{
"property": "total",
"description": "Five different books",
"comments": ["Suggested grouping, [[1,2,3,4,5]]."],
"input": {
"basket": [1,2,3,4,5]
},
"expected": 3000
},
{
"property": "total",
"description": "Two groups of four is cheaper than group of five plus group of three",
"comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5]]."],
"input": {
"basket": [1,1,2,2,3,3,4,5]
},
"expected": 5120
},
{
"property": "total",
"description": "Two groups of four is cheaper than groups of five and three",
"comments": ["Suggested grouping, [[1,2,4,5],[1,3,4,5]]. This differs from the other 'two groups of four' test in that it will fail for solutions that add books to groups in the order in which they appear in the list."],
"input": {
"basket": [1,1,2,3,4,4,5,5]
},
"expected": 5120
},
{
"property": "total",
"description": "Group of four plus group of two is cheaper than two groups of three",
"comments": ["Suggested grouping, [[1,2,3,4],[1,2]]."],
"input": {
"basket": [1,1,2,2,3,4]
},
"expected": 4080
},
{
"property": "total",
"description": "Two each of first 4 books and 1 copy each of rest",
"comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4]]."],
"input": {
"basket": [1,1,2,2,3,3,4,4,5]
},
"expected": 5560
},
{
"property": "total",
"description": "Two copies of each book",
"comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4,5]]."],
"input": {
"basket": [1,1,2,2,3,3,4,4,5,5]
},
"expected": 6000
},
{
"property": "total",
"description": "Three copies of first book and 2 each of remaining",
"comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4,5],[1]]."],
"input": {
"basket": [1,1,2,2,3,3,4,4,5,5,1]
},
"expected": 6800
},
{
"property": "total",
"description": "Three each of first 2 books and 2 each of remaining books",
"comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4,5],[1,2]]."],
"input": {
"basket": [1,1,2,2,3,3,4,4,5,5,1,2]
},
"expected": 7520
},
{
"property": "total",
"description": "Four groups of four are cheaper than two groups each of five and three",
"comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4],[1,2,3,5]]."],
"input": {
"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
},
{
"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
}
]
}
]
}