Skip to content

Commit 76c121c

Browse files
authored
Merge pull request exercism#1201 from sjwarner-bp/book-store-update
book-store: update test suite to 1.2.0
2 parents 776122e + 434254f commit 76c121c

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

‎exercises/book-store/.meta/version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.2.0

‎exercises/book-store/src/test/java/BookStoreTest.java‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ public void setUp() {
2323
@Test
2424
public void onlyASingleBook() {
2525
List<Integer> books = Collections.singletonList(1);
26-
assertEquals(8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
26+
assertEquals(8.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
2727
}
2828

2929
@Ignore("Remove to run test")
3030
@Test
3131
public void twoOfSameBook() {
32-
List<Integer> books = Arrays.asList(1, 1);
33-
assertEquals(16, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
32+
List<Integer> books = Arrays.asList(2, 2);
33+
assertEquals(16.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
3434
}
3535

3636
@Ignore("Remove to run test")
3737
@Test
3838
public void emptyBasket() {
3939
List<Integer> books = Collections.emptyList();
40-
assertEquals(0, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
40+
assertEquals(0.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
4141
}
4242

4343
@Ignore("Remove to run test")
@@ -51,21 +51,21 @@ public void twoDifferentBooks() {
5151
@Test
5252
public void threeDifferentBooks() {
5353
List<Integer> books = Arrays.asList(1, 2, 3);
54-
assertEquals(21.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
54+
assertEquals(21.60, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
5555
}
5656

5757
@Ignore("Remove to run test")
5858
@Test
5959
public void fourDifferentBooks() {
6060
List<Integer> books = Arrays.asList(1, 2, 3, 4);
61-
assertEquals(25.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
61+
assertEquals(25.60, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
6262
}
6363

6464
@Ignore("Remove to run test")
6565
@Test
6666
public void fiveDifferentBooks() {
6767
List<Integer> books = Arrays.asList(1, 2, 3, 4, 5);
68-
assertEquals(30, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
68+
assertEquals(30.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
6969
}
7070

7171
@Ignore("Remove to run test")
@@ -79,7 +79,7 @@ public void twoGroupsOfFourIsCheaperThanGroupOfFivePlusGroupOfThree() {
7979
@Test
8080
public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() {
8181
List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 4);
82-
assertEquals(40.8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
82+
assertEquals(40.80, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
8383
}
8484

8585
@Ignore("Remove to run test")
@@ -110,4 +110,11 @@ public void threeEachOFirst2BooksAnd2EachOfRemainingBooks() {
110110
assertEquals(75.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
111111
}
112112

113+
@Ignore("Remove to run test")
114+
@Test
115+
public void fourGroupsOfFourAreCheaperThanTwoGroupsEachOfFiveAndThree() {
116+
List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5);
117+
assertEquals(102.4, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
118+
}
119+
113120
}

0 commit comments

Comments
 (0)