Przeglądaj źródła

complex-numbers: update tests (#1380)

* Update tests to match canonical data version 1.3.0

* Update version file (1.0.0 -> 1.3.0)
Jack Mustacato 8 lat temu
rodzic
commit
7231746af9

+ 1
- 1
exercises/complex-numbers/.meta/version Wyświetl plik

@@ -1 +1 @@
1
-1.0.0
1
+1.3.0

+ 56
- 48
exercises/complex-numbers/src/test/java/ComplexNumberTest.java Wyświetl plik

@@ -23,6 +23,54 @@ public class ComplexNumberTest {
23 23
     // Tests
24 24
 
25 25
     @Test
26
+    public void testRealPartOfPurelyRealNumber() {
27
+        double expected = 1.0;
28
+        double actual = new ComplexNumber(1.0, 0).getReal();
29
+        assertDoublesEqual(expected, actual, "real");
30
+    }
31
+
32
+    @Ignore("Remove to run test")
33
+    @Test
34
+    public void testRealPartOfPurelyImaginaryNumber() {
35
+        double expected = 0.0;
36
+        double actual = new ComplexNumber(0, 1.0).getReal();
37
+        assertDoublesEqual(expected, actual, "real");
38
+    }
39
+
40
+    @Ignore("Remove to run test")
41
+    @Test
42
+    public void testRealPartOfNumberWithRealAndImaginaryParts() {
43
+        double expected = 1.0;
44
+        double actual = new ComplexNumber(1.0, 2.0).getReal();
45
+        assertDoublesEqual(expected, actual, "real");
46
+    }
47
+
48
+    @Ignore("Remove to run test")
49
+    @Test
50
+    public void testImaginaryPartOfPurelyRealNumber() {
51
+        double expected = 0.0;
52
+        double actual = new ComplexNumber(1.0, 0).getImag();
53
+        assertDoublesEqual(expected, actual, "imaginary");
54
+    }
55
+
56
+    @Ignore("Remove to run test")
57
+    @Test
58
+    public void testImaginaryPartOfPurelyImaginaryNumber() {
59
+        double expected = 1.0;
60
+        double actual = new ComplexNumber(0, 1.0).getImag();
61
+        assertDoublesEqual(expected, actual, "imaginary");
62
+    }
63
+
64
+    @Ignore("Remove to run test")
65
+    @Test
66
+    public void testImaginaryPartOfNumberWithRealAndImaginaryParts() {
67
+        double expected = 2.0;
68
+        double actual = new ComplexNumber(1.0, 2.0).getImag();
69
+        assertDoublesEqual(expected, actual, "imaginary");
70
+    }
71
+
72
+    @Ignore("Remove to run test")
73
+    @Test
26 74
     public void testImaginaryUnitExhibitsDefiningProperty() {
27 75
         ComplexNumber expected = new ComplexNumber(-1.0, 0);
28 76
         ComplexNumber actual = new ComplexNumber(0, 1.0).times(new ComplexNumber(0, 1.0));
@@ -191,54 +239,6 @@ public class ComplexNumberTest {
191 239
 
192 240
     @Ignore("Remove to run test")
193 241
     @Test
194
-    public void testRealPartOfPurelyRealNumber() {
195
-        double expected = 1.0;
196
-        double actual = new ComplexNumber(1.0, 0).getReal();
197
-        assertDoublesEqual(expected, actual, "real");
198
-    }
199
-
200
-    @Ignore("Remove to run test")
201
-    @Test
202
-    public void testRealPartOfPurelyImaginaryNumber() {
203
-        double expected = 0.0;
204
-        double actual = new ComplexNumber(0, 1.0).getReal();
205
-        assertDoublesEqual(expected, actual, "real");
206
-    }
207
-
208
-    @Ignore("Remove to run test")
209
-    @Test
210
-    public void testRealPartOfNumberWithRealAndImaginaryParts() {
211
-        double expected = 1.0;
212
-        double actual = new ComplexNumber(1.0, 2.0).getReal();
213
-        assertDoublesEqual(expected, actual, "real");
214
-    }
215
-
216
-    @Ignore("Remove to run test")
217
-    @Test
218
-    public void testImaginaryPartOfPurelyRealNumber() {
219
-        double expected = 0.0;
220
-        double actual = new ComplexNumber(1.0, 0).getImag();
221
-        assertDoublesEqual(expected, actual, "imaginary");
222
-    }
223
-
224
-    @Ignore("Remove to run test")
225
-    @Test
226
-    public void testImaginaryPartOfPurelyImaginaryNumber() {
227
-        double expected = 1.0;
228
-        double actual = new ComplexNumber(0, 1.0).getImag();
229
-        assertDoublesEqual(expected, actual, "imaginary");
230
-    }
231
-
232
-    @Ignore("Remove to run test")
233
-    @Test
234
-    public void testImaginaryPartOfNumberWithRealAndImaginaryParts() {
235
-        double expected = 2.0;
236
-        double actual = new ComplexNumber(1.0, 2.0).getImag();
237
-        assertDoublesEqual(expected, actual, "imaginary");
238
-    }
239
-
240
-    @Ignore("Remove to run test")
241
-    @Test
242 242
     public void testExponentialOfPurelyImaginaryNumber() {
243 243
         ComplexNumber expected = new ComplexNumber(-1.0, 0);
244 244
         ComplexNumber actual = new ComplexNumber(0, Math.PI).exponentialOf();
@@ -261,4 +261,12 @@ public class ComplexNumberTest {
261 261
         assertComplexNumbersEqual(expected, actual);
262 262
     }
263 263
 
264
+    @Ignore("Remove to run test")
265
+    @Test
266
+    public void testExponentialOfNumberWithRealAndImaginaryParts() {
267
+        ComplexNumber expected = new ComplexNumber(-2.0, 0);
268
+        ComplexNumber actual = new ComplexNumber(Math.log(2.0), Math.PI).exponentialOf();
269
+        assertComplexNumbersEqual(expected, actual);
270
+    }
271
+
264 272
 }