Leon 5 年前
父节点
当前提交
d05ffe0367
共有 1 个文件被更改,包括 6 次插入9 次删除
  1. 6
    9
      src/test/java/rocks/zipcode/quiz3a/fundamentals/calculator/SubtractTest.java

+ 6
- 9
src/test/java/rocks/zipcode/quiz3a/fundamentals/calculator/SubtractTest.java 查看文件

@@ -11,37 +11,34 @@ public class SubtractTest {
11 11
     @Test
12 12
     public void test1() {
13 13
         // given
14
-        test(32.70, 49.04);
14
+        test(5.0, 10.0, 5.0);
15 15
     }
16 16
 
17 17
     @Test
18 18
     public void test2() {
19 19
         // given
20
-        test(689.93, 746.00);
20
+        test(150.0, 250.0, 100.0);
21 21
     }
22 22
 
23 23
     @Test
24 24
     public void test3() {
25 25
         // given
26
-        test(35354.0, 74542.0);
26
+        test(762.0, 862.0, 100.0);
27 27
     }
28 28
 
29 29
     @Test
30 30
     public void test4() {
31 31
         // given
32
-        test(746.93774653, 889409027.3737773635554244);
32
+        test(-899.999, -999.999, -100.0);
33 33
     }
34 34
 
35 35
     @Test
36 36
     public void test5() {
37 37
         // given
38
-        test(99873636.94874, 839.03);
38
+        test(-10.0, -5.0, 5.0);
39 39
     }
40 40
 
41
-    private void test(Double input1, Double input2) {
42
-        // given
43
-        Double expected = input1 - input2;
44
-
41
+    private void test(Double expected, Double input1, Double input2) {
45 42
         // when
46 43
         Calculator calculator = new Calculator();
47 44
         Double actual = calculator.subtract(input1, input2);