Quellcode durchsuchen

Merge pull request #1201 from sjwarner-bp/book-store-update

book-store: update test suite to 1.2.0
FridaTveit vor 8 Jahren
Ursprung
Commit
76c121c435
Es ist kein Account mit dieser Commiter-Email verbunden

+ 1
- 0
exercises/book-store/.meta/version Datei anzeigen

1
+1.2.0

+ 15
- 8
exercises/book-store/src/test/java/BookStoreTest.java Datei anzeigen

23
   @Test
23
   @Test
24
   public void onlyASingleBook() {
24
   public void onlyASingleBook() {
25
     List<Integer> books = Collections.singletonList(1);
25
     List<Integer> books = Collections.singletonList(1);
26
-    assertEquals(8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
26
+    assertEquals(8.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
27
   }
27
   }
28
 
28
 
29
   @Ignore("Remove to run test")
29
   @Ignore("Remove to run test")
30
   @Test
30
   @Test
31
   public void twoOfSameBook() {
31
   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);
34
   }
34
   }
35
 
35
 
36
   @Ignore("Remove to run test")
36
   @Ignore("Remove to run test")
37
   @Test
37
   @Test
38
   public void emptyBasket() {
38
   public void emptyBasket() {
39
     List<Integer> books = Collections.emptyList();
39
     List<Integer> books = Collections.emptyList();
40
-    assertEquals(0, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
40
+    assertEquals(0.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
41
   }
41
   }
42
 
42
 
43
   @Ignore("Remove to run test")
43
   @Ignore("Remove to run test")
51
   @Test
51
   @Test
52
   public void threeDifferentBooks() {
52
   public void threeDifferentBooks() {
53
     List<Integer> books = Arrays.asList(1, 2, 3);
53
     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);
55
   }
55
   }
56
 
56
 
57
   @Ignore("Remove to run test")
57
   @Ignore("Remove to run test")
58
   @Test
58
   @Test
59
   public void fourDifferentBooks() {
59
   public void fourDifferentBooks() {
60
     List<Integer> books = Arrays.asList(1, 2, 3, 4);
60
     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);
62
   }
62
   }
63
 
63
 
64
   @Ignore("Remove to run test")
64
   @Ignore("Remove to run test")
65
   @Test
65
   @Test
66
   public void fiveDifferentBooks() {
66
   public void fiveDifferentBooks() {
67
     List<Integer> books = Arrays.asList(1, 2, 3, 4, 5);
67
     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);
69
   }
69
   }
70
 
70
 
71
   @Ignore("Remove to run test")
71
   @Ignore("Remove to run test")
79
   @Test
79
   @Test
80
   public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() {
80
   public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() {
81
     List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 4);
81
     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);
83
   }
83
   }
84
 
84
 
85
   @Ignore("Remove to run test")
85
   @Ignore("Remove to run test")
110
     assertEquals(75.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
110
     assertEquals(75.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
111
   }
111
   }
112
 
112
 
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
+
113
 }
120
 }