Leon 5 years ago
parent
commit
6192a74ef7

BIN
MathUtilities.class View File


+ 1
- 7
MathUtilities.ctxt View File

52
 comment24.params=multiplicand\ multiplier
52
 comment24.params=multiplicand\ multiplier
53
 comment24.target=java.lang.Double\ multiply(double,\ double)
53
 comment24.target=java.lang.Double\ multiply(double,\ double)
54
 comment24.text=\n\ @param\ multiplicand\ value\ to\ be\ multiplied\n\ @param\ multiplier\ value\ to\ multiply\ by\n\ @return\ product\ of\ `multiplicand`\ by\ `multiplier`\n
54
 comment24.text=\n\ @param\ multiplicand\ value\ to\ be\ multiplied\n\ @param\ multiplier\ value\ to\ multiply\ by\n\ @return\ product\ of\ `multiplicand`\ by\ `multiplier`\n
55
-comment25.params=
56
-comment25.target=java.lang.Boolean\ returnTrue()
57
-comment25.text=\n\ @return\ true\n
58
-comment26.params=
59
-comment26.target=java.lang.Boolean\ returnFalse()
60
-comment26.text=\n\ @return\ false\n
61
 comment3.params=baseValue\ difference
55
 comment3.params=baseValue\ difference
62
 comment3.target=java.lang.Short\ add(short,\ short)
56
 comment3.target=java.lang.Short\ add(short,\ short)
63
 comment3.text=\n\ @param\ baseValue\ \ starting\ value\n\ @param\ difference\ value\ to\ add\ to\ starting\ value\n\ @return\ sum\ of\ `baseValue`\ and\ `difference`\n
57
 comment3.text=\n\ @param\ baseValue\ \ starting\ value\n\ @param\ difference\ value\ to\ add\ to\ starting\ value\n\ @return\ sum\ of\ `baseValue`\ and\ `difference`\n
79
 comment9.params=baseValue\ difference
73
 comment9.params=baseValue\ difference
80
 comment9.target=java.lang.Short\ subtract(short,\ short)
74
 comment9.target=java.lang.Short\ subtract(short,\ short)
81
 comment9.text=\n\ @param\ baseValue\ \ starting\ value\n\ @param\ difference\ value\ to\ subtract\ from\ starting\ value\n\ @return\ difference\ between\ `baseValue`\ and\ `difference`\n
75
 comment9.text=\n\ @param\ baseValue\ \ starting\ value\n\ @param\ difference\ value\ to\ subtract\ from\ starting\ value\n\ @return\ difference\ between\ `baseValue`\ and\ `difference`\n
82
-numComments=27
76
+numComments=25

+ 0
- 16
MathUtilities.java View File

221
     public Double multiply(double multiplicand, double multiplier) {
221
     public Double multiply(double multiplicand, double multiplier) {
222
         return null;
222
         return null;
223
     }
223
     }
224
-
225
-
226
-    /**
227
-      * @return true
228
-     */
229
-    public Boolean returnTrue() {
230
-        return null;
231
-    }
232
-
233
-    /**
234
-     * @return false
235
-     */
236
-    public Boolean returnFalse() {
237
-        return null;
238
-    }
239
-
240
 }
224
 }

BIN
MathUtilitiesTest.class View File


+ 0
- 56
MathUtilitiesTest.ctxt View File

1
-#BlueJ class context
2
-comment0.target=MathUtilitiesTest
3
-comment0.text=\n\ Created\ by\ dan\ on\ 6/14/17.\n
4
-comment1.params=
5
-comment1.target=void\ testAdditions()
6
-comment10.params=
7
-comment10.target=void\ testSubtractions3()
8
-comment11.params=
9
-comment11.target=void\ testSubtractions4()
10
-comment12.params=
11
-comment12.target=void\ testSubtractions5()
12
-comment13.params=
13
-comment13.target=void\ testDivision()
14
-comment14.params=
15
-comment14.target=void\ testDivision1()
16
-comment15.params=
17
-comment15.target=void\ testDivision2()
18
-comment16.params=
19
-comment16.target=void\ testDivision3()
20
-comment17.params=
21
-comment17.target=void\ testDivision4()
22
-comment18.params=
23
-comment18.target=void\ testDivision5()
24
-comment19.params=
25
-comment19.target=void\ testMultiplication()
26
-comment2.params=
27
-comment2.target=void\ testAdditions1()
28
-comment20.params=
29
-comment20.target=void\ testMultiplication1()
30
-comment21.params=
31
-comment21.target=void\ testMultiplication2()
32
-comment22.params=
33
-comment22.target=void\ testMultiplication3()
34
-comment23.params=
35
-comment23.target=void\ testMultiplication4()
36
-comment24.params=
37
-comment24.target=void\ testMultiplication5()
38
-comment25.params=
39
-comment25.target=void\ testReturnTrue()
40
-comment26.params=
41
-comment26.target=void\ testReturnFalse()
42
-comment3.params=
43
-comment3.target=void\ testAdditions2()
44
-comment4.params=
45
-comment4.target=void\ testAdditions4()
46
-comment5.params=
47
-comment5.target=void\ testAdditions5()
48
-comment6.params=
49
-comment6.target=void\ testAdditions6()
50
-comment7.params=
51
-comment7.target=void\ testSubtractions()
52
-comment8.params=
53
-comment8.target=void\ testSubtractions1()
54
-comment9.params=
55
-comment9.target=void\ testSubtractions2()
56
-numComments=27

+ 0
- 344
MathUtilitiesTest.java View File

1
- 
2
-
3
-import org.junit.Test;
4
-
5
-import static org.junit.Assert.*;
6
-/**
7
- * Created by dan on 6/14/17.
8
- */
9
-public class MathUtilitiesTest {
10
-    private static volatile MathUtilities primativeTypes = new MathUtilities();
11
-
12
-    @Test
13
-    public void testAdditions() {
14
-        // : Given
15
-        int baseValue = 20;
16
-        int addedValue = 7;
17
-        int expected = 27;
18
-        // : When
19
-        int actual = primativeTypes.add(baseValue, addedValue);
20
-        // : Then
21
-        assertEquals(expected,actual);
22
-    }
23
-    @Test
24
-    public void testAdditions1() {
25
-        // : Given
26
-        long baseValue = 228437266;
27
-        long difference = 228437265;
28
-        long expected = 456874531;
29
-        // : When
30
-        long actual = primativeTypes.add(baseValue, difference);
31
-        // : Then
32
-        assertEquals(expected,actual);
33
-    }
34
-    @Test
35
-    public void testAdditions2() {
36
-        // : Given
37
-        short baseValue = 16384;
38
-        short addedValue = 7;
39
-        short expected = 16391;
40
-        // : When
41
-        short actual = primativeTypes.add(baseValue, addedValue);
42
-        // : Then
43
-        assertEquals(expected,actual);
44
-    }
45
-
46
-    @Test
47
-    public void testAdditions4() {
48
-        // : Given
49
-        byte baseValue = 63;
50
-        byte addedValue = 64;
51
-        byte expected = 127;
52
-        // : When
53
-        byte actual = primativeTypes.add(baseValue, addedValue);
54
-        // : Then
55
-        assertEquals(expected,actual);
56
-    }
57
-    @Test
58
-    public void testAdditions5() {
59
-        // : Given
60
-        float baseValue = 750.585F;
61
-        float addedValue = 795.000F;
62
-        float expected = 1545.585F;
63
-        // : When
64
-        float actual = primativeTypes.add(baseValue, addedValue);
65
-        // : Then
66
-        assertEquals(expected,actual, 0);
67
-    }
68
-
69
-    @Test
70
-    public void testAdditions6() {
71
-        // : Given
72
-        double baseValue = 225.25;
73
-        double addedValue = 231;
74
-        double expected = 456.25;
75
-        // : When
76
-        double actual = primativeTypes.add(baseValue,addedValue);
77
-        // : Then
78
-        assertEquals(expected,actual, 0);
79
-    }
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-    @Test
97
-    public void testSubtractions(){
98
-        // : Given
99
-        int baseValue = 20;
100
-        int difference = 7;
101
-        int expectedInt = 13;
102
-        // : When
103
-        int actualInt = primativeTypes.subtract(baseValue,difference);
104
-        // : Then
105
-        assertEquals(expectedInt,actualInt);
106
-    }
107
-    @Test
108
-    public void testSubtractions1() {
109
-        // : Given
110
-        long baseValue = 228437266;
111
-        long difference = 228437265;
112
-        long expectedLong = 1;
113
-        // : When
114
-        long actualLong = primativeTypes.subtract(baseValue, difference);
115
-        // : Then
116
-        assertEquals(expectedLong,actualLong);
117
-    }
118
-    @Test
119
-    public void testSubtractions2() {
120
-        // : Given
121
-        short baseValue = 16384;
122
-        short difference = 16383;
123
-        short expectedShort = 1;
124
-        // : When
125
-        short actualShort = primativeTypes.subtract(baseValue, difference);
126
-        // : Then
127
-        assertEquals(expectedShort,actualShort);
128
-    }
129
-    @Test
130
-    public void testSubtractions3() {
131
-        // : Given
132
-        byte baseValue = 63;
133
-        byte difference = 64;
134
-        byte expectedByte = -1;
135
-        // : When
136
-        byte actualByte = primativeTypes.subtract(baseValue, difference);
137
-        // : Then
138
-        assertEquals(expectedByte,actualByte);
139
-    }
140
-    @Test
141
-    public void testSubtractions4() {
142
-        // : Given
143
-        float baseValue = 750.585F;
144
-        float difference = 795.0F;
145
-        float expectedFloat = -44.415F;
146
-        // : When
147
-        float actualFloat = primativeTypes.subtract(baseValue,difference);
148
-        // : Then
149
-        assertEquals(expectedFloat,actualFloat, 0.005);
150
-    }
151
-    @Test
152
-    public void testSubtractions5() {
153
-        // : Given
154
-        double baseValue = 225.25;
155
-        double difference = 231;
156
-        double expectedDouble = -5.75;
157
-        // : When
158
-        double actualDouble = primativeTypes.subtract(baseValue, difference);
159
-        // : Then
160
-        assertEquals(expectedDouble,actualDouble, 0);
161
-    }
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-    @Test
177
-    public void testDivision(){
178
-        // : Given
179
-        int dividend = 20;
180
-        int divisor = 2;
181
-        int expectedInt = 10;
182
-        // : When
183
-        int actualInt = primativeTypes.divide(dividend, divisor);
184
-        // : Then
185
-        assertEquals(expectedInt,actualInt);
186
-    }
187
-    @Test
188
-    public void testDivision1() {
189
-        // : Given
190
-        int dividend = 20000000;
191
-        int divisor = 1000;
192
-        long expectedLong = 20000;
193
-        // : When
194
-        long actualLong = primativeTypes.divide(dividend, divisor);
195
-        // : Then
196
-        assertEquals(expectedLong,actualLong);
197
-    }
198
-    @Test
199
-    public void testDivision2() {
200
-        // : Given
201
-        short dividend = 2;
202
-        short divisor = 1;
203
-        short expectedShort = 2;
204
-        // : When
205
-        short actualShort = primativeTypes.divide(dividend, divisor);
206
-        // : Then
207
-        assertEquals(expectedShort,actualShort);
208
-
209
-    }
210
-    @Test
211
-    public void testDivision3() {
212
-        // : Given
213
-        byte dividend = 64;
214
-        byte divisor = 32;
215
-        byte expectedByte = 2;
216
-        // : When
217
-        byte actualByte = primativeTypes.divide(dividend, divisor);
218
-        // : Then
219
-        assertEquals(expectedByte,actualByte);
220
-    }
221
-    @Test
222
-    public void testDivision4() {
223
-        // : Given
224
-        float dividend = 7.5F;
225
-        float divisor = 3;
226
-        float expectedFloat = 2.50F;
227
-        // : When
228
-        float actualFloat = primativeTypes.divide(dividend,divisor);
229
-        // : Then
230
-        assertEquals(expectedFloat,actualFloat, 0);
231
-    }
232
-    @Test
233
-    public void testDivision5() {
234
-        // : Given
235
-        double dividend = 5.0;
236
-        double divisor = 4.0;
237
-        double expectedDouble = 1.25;
238
-        // : When
239
-        double actualDouble = primativeTypes.divide(dividend,divisor);
240
-        // : Then
241
-        assertEquals(expectedDouble,actualDouble, 0);
242
-    }
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-    @Test
262
-    public void testMultiplication(){
263
-        // : Given
264
-        int multiplicand = 5;
265
-        int multiplier = 2;
266
-        int expectedInt = 10;
267
-        // : When
268
-        int actualInt = primativeTypes.multiply(multiplicand,multiplier);
269
-        // : Then
270
-        assertEquals(expectedInt,actualInt);
271
-    }
272
-    @Test
273
-    public void testMultiplication1() {
274
-        // : Given
275
-        long multiplicand = 20;
276
-        long multiplier = 1000;
277
-        long expectedLong = 20000;
278
-        // : When
279
-        long actualLong = primativeTypes.multiply(multiplicand, multiplier);
280
-        // : Then
281
-        assertEquals(expectedLong, actualLong);
282
-    }
283
-    @Test
284
-    public void testMultiplication2() {
285
-        // : Given
286
-        short multiplicand = 2;
287
-        short multiplier = 1;
288
-        short expectedShort = 2;
289
-        // : When
290
-        short actualShort = primativeTypes.multiply(multiplicand, multiplier);
291
-        // : Then
292
-        assertEquals(expectedShort, actualShort);
293
-    }
294
-    @Test
295
-    public void testMultiplication3() {
296
-        // : Given
297
-        byte multiplicand = 16;
298
-        byte multiplier = 4;
299
-        byte expectedByte = 64;
300
-        // : When
301
-        byte actualByte = primativeTypes.multiply(multiplicand, multiplier);
302
-        // : Then
303
-        assertEquals(expectedByte, actualByte);
304
-    }
305
-    @Test
306
-    public void testMultiplication4() {
307
-        // : Given
308
-        float multiplicand = 2.5F;
309
-        float multiplier = 1;
310
-        float expectedFloat = 2.50F;
311
-        // : When
312
-        float actualFloat =  primativeTypes.multiply(multiplicand,multiplier);
313
-        // : Then
314
-        assertEquals(expectedFloat, actualFloat, 0);
315
-    }
316
-    @Test
317
-    public void testMultiplication5() {
318
-        // : Given
319
-        double multiplicand = 3.25;
320
-        double multiplier = 3.0;
321
-        double expectedDouble = 9.75;
322
-        // : When
323
-        double actualDouble = primativeTypes.multiply(multiplicand,multiplier);
324
-        // : Then
325
-        assertEquals(expectedDouble, actualDouble, 0);
326
-    }
327
-
328
-    @Test
329
-    public void testReturnTrue(){
330
-        // : Given
331
-        // : When
332
-        // : Then
333
-        assertTrue(primativeTypes.returnTrue());
334
-    }
335
-
336
-    @Test
337
-    public void testReturnFalse(){
338
-        // : Given
339
-        // : When
340
-        // : Then
341
-        assertFalse(primativeTypes.returnFalse());
342
-    }
343
-
344
-}

BIN
PredicateUtilities.class View File


+ 7
- 1
PredicateUtilities.ctxt View File

13
 comment4.params=x\ y
13
 comment4.params=x\ y
14
 comment4.target=java.lang.Boolean\ isLessThanOrEqualTo(int,\ int)
14
 comment4.target=java.lang.Boolean\ isLessThanOrEqualTo(int,\ int)
15
 comment4.text=\n\ @param\ x\n\ @param\ y\n\ @return\ true\ if\ `x`\ is\ less\ than\ or\ equal\ to\ `y`\n
15
 comment4.text=\n\ @param\ x\n\ @param\ y\n\ @return\ true\ if\ `x`\ is\ less\ than\ or\ equal\ to\ `y`\n
16
-numComments=5
16
+comment5.params=
17
+comment5.target=java.lang.Boolean\ returnTrue()
18
+comment5.text=\n\ @return\ true\n
19
+comment6.params=
20
+comment6.target=java.lang.Boolean\ returnFalse()
21
+comment6.text=\n\ @return\ false\n
22
+numComments=7

+ 15
- 0
PredicateUtilities.java View File

39
     public Boolean isLessThanOrEqualTo(int x, int y) {
39
     public Boolean isLessThanOrEqualTo(int x, int y) {
40
         return null;
40
         return null;
41
     }
41
     }
42
+    
43
+    
44
+       /**
45
+      * @return true
46
+     */
47
+    public Boolean returnTrue() {
48
+        return null;
49
+    }
50
+
51
+    /**
52
+     * @return false
53
+     */
54
+    public Boolean returnFalse() {
55
+        return null;
56
+    }
42
 }
57
 }

BIN
PredicateUtilitiesTest.class View File


+ 5
- 1
PredicateUtilitiesTest.ctxt View File

3
 comment0.text=\n\ Created\ by\ dan\ on\ 6/14/17.\n
3
 comment0.text=\n\ Created\ by\ dan\ on\ 6/14/17.\n
4
 comment1.params=
4
 comment1.params=
5
 comment1.target=void\ testGreaterThanTrue()
5
 comment1.target=void\ testGreaterThanTrue()
6
+comment10.params=
7
+comment10.target=void\ testReturnFalse()
6
 comment2.params=
8
 comment2.params=
7
 comment2.target=void\ testGreaterThanFalse()
9
 comment2.target=void\ testGreaterThanFalse()
8
 comment3.params=
10
 comment3.params=
17
 comment7.target=void\ testGreaterOrEqual1()
19
 comment7.target=void\ testGreaterOrEqual1()
18
 comment8.params=
20
 comment8.params=
19
 comment8.target=void\ testGreaterOrEqual2()
21
 comment8.target=void\ testGreaterOrEqual2()
20
-numComments=9
22
+comment9.params=
23
+comment9.target=void\ testReturnTrue()
24
+numComments=11

+ 20
- 9
PredicateUtilitiesTest.java View File

8
  * Created by dan on 6/14/17.
8
  * Created by dan on 6/14/17.
9
  */
9
  */
10
 public class PredicateUtilitiesTest {
10
 public class PredicateUtilitiesTest {
11
-    private static volatile PredicateUtilities math = new PredicateUtilities();
11
+    private static volatile PredicateUtilities predicateUtils = new PredicateUtilities();
12
 
12
 
13
     @Test
13
     @Test
14
     public void testGreaterThanTrue() {
14
     public void testGreaterThanTrue() {
18
 
18
 
19
 
19
 
20
         // : When
20
         // : When
21
-        boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
21
+        boolean outcome = predicateUtils.isGreaterThan(greaterValue, lesserValue);
22
 
22
 
23
         // : Then
23
         // : Then
24
         assertTrue(outcome);
24
         assertTrue(outcome);
32
         int lesserValue = 350;
32
         int lesserValue = 350;
33
 
33
 
34
         // : When
34
         // : When
35
-        boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
35
+        boolean outcome = predicateUtils.isGreaterThan(greaterValue, lesserValue);
36
 
36
 
37
         // : Then
37
         // : Then
38
         assertFalse(outcome);
38
         assertFalse(outcome);
46
         int lesserValue = 350;
46
         int lesserValue = 350;
47
 
47
 
48
         // : When
48
         // : When
49
-        boolean outcome = math.isLessThan(greaterValue, lesserValue);
49
+        boolean outcome = predicateUtils.isLessThan(greaterValue, lesserValue);
50
 
50
 
51
         // : Then
51
         // : Then
52
         assertFalse(outcome);
52
         assertFalse(outcome);
60
         int lesserValue = 350;
60
         int lesserValue = 350;
61
 
61
 
62
         // : When
62
         // : When
63
-        boolean outcome = math.isLessThan(greaterValue, lesserValue);
63
+        boolean outcome = predicateUtils.isLessThan(greaterValue, lesserValue);
64
 
64
 
65
         // : Then
65
         // : Then
66
         assertFalse(outcome);
66
         assertFalse(outcome);
74
         int lesserValue = 3;
74
         int lesserValue = 3;
75
 
75
 
76
         // : When
76
         // : When
77
-        boolean outcome = math.isLessThanOrEqualTo(greaterValue, lesserValue);
77
+        boolean outcome = predicateUtils.isLessThanOrEqualTo(greaterValue, lesserValue);
78
 
78
 
79
         // : Then
79
         // : Then
80
         assertTrue(outcome);
80
         assertTrue(outcome);
87
         int lesserValue = 6;
87
         int lesserValue = 6;
88
 
88
 
89
         // : When
89
         // : When
90
-        boolean outcome = math.isLessThanOrEqualTo(greaterValue, lesserValue);
90
+        boolean outcome = predicateUtils.isLessThanOrEqualTo(greaterValue, lesserValue);
91
 
91
 
92
         // : Then
92
         // : Then
93
         assertTrue(outcome);
93
         assertTrue(outcome);
100
         int lesserValue = 4;
100
         int lesserValue = 4;
101
 
101
 
102
         // : When
102
         // : When
103
-        boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
103
+        boolean outcome = predicateUtils.isGreaterThanOrEqualTo(greaterValue, lesserValue);
104
 
104
 
105
         // : ThenP
105
         // : ThenP
106
         assertTrue(outcome);
106
         assertTrue(outcome);
114
         int lesserValue = 15;
114
         int lesserValue = 15;
115
 
115
 
116
         // : When
116
         // : When
117
-        boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
117
+        boolean outcome = predicateUtils.isGreaterThanOrEqualTo(greaterValue, lesserValue);
118
 
118
 
119
         // : Then
119
         // : Then
120
         assertFalse(outcome);
120
         assertFalse(outcome);
121
     }
121
     }
122
+    
123
+    @Test
124
+    public void testReturnTrue() {
125
+        assertTrue(predicateUtils.returnTrue());
126
+    }
127
+    
128
+    
129
+    @Test
130
+    public void testReturnFalse() {
131
+        assertFalse(predicateUtils.returnFalse());
132
+    }
122
 }
133
 }

BIN
TestAddition.class View File


+ 16
- 0
TestAddition.ctxt View File

1
+#BlueJ class context
2
+comment0.target=TestAddition
3
+comment0.text=\n\ @author\ leon\ on\ 8/26/18.\n
4
+comment1.params=
5
+comment1.target=void\ testIntegerAddition()
6
+comment2.params=
7
+comment2.target=void\ testLongAddition()
8
+comment3.params=
9
+comment3.target=void\ testShortAddition()
10
+comment4.params=
11
+comment4.target=void\ testByteAddition()
12
+comment5.params=
13
+comment5.target=void\ testFloatAddition()
14
+comment6.params=
15
+comment6.target=void\ testDoubleAddition()
16
+numComments=7

+ 84
- 0
TestAddition.java View File

1
+import org.junit.Test;
2
+
3
+import static org.junit.Assert.assertEquals;
4
+
5
+/**
6
+ * @author leon on 8/26/18.
7
+ */
8
+public class TestAddition {
9
+    private static volatile MathUtilities mathUtils = new MathUtilities();
10
+
11
+    @Test
12
+    public void testIntegerAddition() {
13
+        // : Given
14
+        int baseValue = 20;
15
+        int addedValue = 7;
16
+        int expected = 27;
17
+        // : When
18
+        int actual = mathUtils.add(baseValue, addedValue);
19
+        // : Then
20
+        assertEquals(expected, actual);
21
+    }
22
+
23
+    @Test
24
+    public void testLongAddition() {
25
+        // : Given
26
+        long baseValue = 228437266;
27
+        long difference = 228437265;
28
+        long expected = 456874531;
29
+        // : When
30
+        long actual = mathUtils.add(baseValue, difference);
31
+        // : Then
32
+        assertEquals(expected, actual);
33
+    }
34
+
35
+    @Test
36
+    public void testShortAddition() {
37
+        // : Given
38
+        short baseValue = 16384;
39
+        short addedValue = 7;
40
+        short expected = 16391;
41
+        // : When
42
+        short actual = mathUtils.add(baseValue, addedValue);
43
+        // : Then
44
+        assertEquals(expected, actual);
45
+    }
46
+
47
+    @Test
48
+    public void testByteAddition() {
49
+        // : Given
50
+        byte baseValue = 63;
51
+        byte addedValue = 64;
52
+        byte expected = 127;
53
+        // : When
54
+        byte actual = mathUtils.add(baseValue, addedValue);
55
+        // : Then
56
+        assertEquals(expected, actual);
57
+    }
58
+
59
+    @Test
60
+    public void testFloatAddition() {
61
+        // : Given
62
+        float baseValue = 750.585F;
63
+        float addedValue = 795.000F;
64
+        float expected = 1545.585F;
65
+        // : When
66
+        float actual = mathUtils.add(baseValue, addedValue);
67
+        // : Then
68
+        assertEquals(expected, actual, 0);
69
+    }
70
+
71
+    @Test
72
+    public void testDoubleAddition() {
73
+        // : Given
74
+        double baseValue = 225.25;
75
+        double addedValue = 231;
76
+        double expected = 456.25;
77
+        // : When
78
+        double actual = mathUtils.add(baseValue, addedValue);
79
+        // : Then
80
+        assertEquals(expected, actual, 0);
81
+    }
82
+
83
+
84
+}

BIN
TestDivision.class View File


+ 16
- 0
TestDivision.ctxt View File

1
+#BlueJ class context
2
+comment0.target=TestDivision
3
+comment0.text=\n\ @author\ leon\ on\ 8/26/18.\n
4
+comment1.params=
5
+comment1.target=void\ testIntegerDivision()
6
+comment2.params=
7
+comment2.target=void\ testLongDivision()
8
+comment3.params=
9
+comment3.target=void\ testShortDivision()
10
+comment4.params=
11
+comment4.target=void\ testByteDivision()
12
+comment5.params=
13
+comment5.target=void\ testFloatDivision()
14
+comment6.params=
15
+comment6.target=void\ testDoubleDivision()
16
+numComments=7

+ 86
- 0
TestDivision.java View File

1
+import org.junit.Test;
2
+
3
+import static org.junit.Assert.assertEquals;
4
+
5
+/**
6
+ * @author leon on 8/26/18.
7
+ */
8
+public class TestDivision {
9
+    private static volatile MathUtilities mathUtils = new MathUtilities();
10
+
11
+
12
+    @Test
13
+    public void testIntegerDivision() {
14
+        // : Given
15
+        int dividend = 20;
16
+        int divisor = 2;
17
+        int expectedInt = 10;
18
+        // : When
19
+        int actualInt = mathUtils.divide(dividend, divisor);
20
+        // : Then
21
+        assertEquals(expectedInt, actualInt);
22
+    }
23
+
24
+    @Test
25
+    public void testLongDivision() {
26
+        // : Given
27
+        long dividend = 20000000L;
28
+        long divisor = 1000L;
29
+        long expectedLong = 20000;
30
+        // : When
31
+        long actualLong = mathUtils.divide(dividend, divisor);
32
+        // : Then
33
+        assertEquals(expectedLong, actualLong);
34
+    }
35
+
36
+    @Test
37
+    public void testShortDivision() {
38
+        // : Given
39
+        short dividend = 2;
40
+        short divisor = 1;
41
+        short expectedShort = 2;
42
+        // : When
43
+        short actualShort = mathUtils.divide(dividend, divisor);
44
+        // : Then
45
+        assertEquals(expectedShort, actualShort);
46
+
47
+    }
48
+
49
+    @Test
50
+    public void testByteDivision() {
51
+        // : Given
52
+        byte dividend = 64;
53
+        byte divisor = 32;
54
+        byte expectedByte = 2;
55
+        // : When
56
+        byte actualByte = mathUtils.divide(dividend, divisor);
57
+        // : Then
58
+        assertEquals(expectedByte, actualByte);
59
+    }
60
+
61
+    @Test
62
+    public void testFloatDivision() {
63
+        // : Given
64
+        float dividend = 7.5F;
65
+        float divisor = 3;
66
+        float expectedFloat = 2.50F;
67
+        // : When
68
+        float actualFloat = mathUtils.divide(dividend, divisor);
69
+        // : Then
70
+        assertEquals(expectedFloat, actualFloat, 0);
71
+    }
72
+
73
+    @Test
74
+    public void testDoubleDivision() {
75
+        // : Given
76
+        double dividend = 5.0;
77
+        double divisor = 4.0;
78
+        double expectedDouble = 1.25;
79
+        // : When
80
+        double actualDouble = mathUtils.divide(dividend, divisor);
81
+        // : Then
82
+        assertEquals(expectedDouble, actualDouble, 0);
83
+    }
84
+
85
+
86
+}

BIN
TestMultiplication.class View File


+ 16
- 0
TestMultiplication.ctxt View File

1
+#BlueJ class context
2
+comment0.target=TestMultiplication
3
+comment0.text=\n\ @author\ leon\ on\ 8/26/18.\n
4
+comment1.params=
5
+comment1.target=void\ testIntegerMultiplication()
6
+comment2.params=
7
+comment2.target=void\ testLongMultiplication()
8
+comment3.params=
9
+comment3.target=void\ testShortMultiplication()
10
+comment4.params=
11
+comment4.target=void\ testByteMultiplication()
12
+comment5.params=
13
+comment5.target=void\ testFloatMultiplication()
14
+comment6.params=
15
+comment6.target=void\ testDoubleMultiplication()
16
+numComments=7

+ 79
- 0
TestMultiplication.java View File

1
+import org.junit.Test;
2
+
3
+import static org.junit.Assert.assertEquals;
4
+
5
+/**
6
+ * @author leon on 8/26/18.
7
+ */
8
+public class TestMultiplication {
9
+
10
+    private static volatile MathUtilities mathUtils = new MathUtilities();
11
+
12
+
13
+    @Test
14
+    public void testIntegerMultiplication(){
15
+        // : Given
16
+        int multiplicand = 5;
17
+        int multiplier = 2;
18
+        int expectedInt = 10;
19
+        // : When
20
+        int actualInt = mathUtils.multiply(multiplicand,multiplier);
21
+        // : Then
22
+        assertEquals(expectedInt,actualInt);
23
+    }
24
+    @Test
25
+    public void testLongMultiplication() {
26
+        // : Given
27
+        long multiplicand = 20;
28
+        long multiplier = 1000;
29
+        long expectedLong = 20000;
30
+        // : When
31
+        long actualLong = mathUtils.multiply(multiplicand, multiplier);
32
+        // : Then
33
+        assertEquals(expectedLong, actualLong);
34
+    }
35
+    @Test
36
+    public void testShortMultiplication() {
37
+        // : Given
38
+        short multiplicand = 2;
39
+        short multiplier = 1;
40
+        short expectedShort = 2;
41
+        // : When
42
+        short actualShort = mathUtils.multiply(multiplicand, multiplier);
43
+        // : Then
44
+        assertEquals(expectedShort, actualShort);
45
+    }
46
+    @Test
47
+    public void testByteMultiplication() {
48
+        // : Given
49
+        byte multiplicand = 16;
50
+        byte multiplier = 14;
51
+        byte expectedByte = 64;
52
+        // : When
53
+        byte actualByte = mathUtils.multiply(multiplicand, multiplier);
54
+        // : Then
55
+        assertEquals(expectedByte, actualByte);
56
+    }
57
+    @Test
58
+    public void testFloatMultiplication() {
59
+        // : Given
60
+        float multiplicand = 2.5F;
61
+        float multiplier = 1;
62
+        float expectedFloat = 2.50F;
63
+        // : When
64
+        float actualFloat =  mathUtils.multiply(multiplicand,multiplier);
65
+        // : Then
66
+        assertEquals(expectedFloat, actualFloat, 0);
67
+    }
68
+    @Test
69
+    public void testDoubleMultiplication() {
70
+        // : Given
71
+        double multiplicand = 3.25;
72
+        double multiplier = 3.0;
73
+        double expectedDouble = 9.75;
74
+        // : When
75
+        double actualDouble = mathUtils.multiply(multiplicand,multiplier);
76
+        // : Then
77
+        assertEquals(expectedDouble, actualDouble, 0);
78
+    }
79
+}

BIN
TestSubtraction.class View File


+ 16
- 0
TestSubtraction.ctxt View File

1
+#BlueJ class context
2
+comment0.target=TestSubtraction
3
+comment0.text=\n\ @author\ leon\ on\ 8/26/18.\n
4
+comment1.params=
5
+comment1.target=void\ testIntegerSubtraction()
6
+comment2.params=
7
+comment2.target=void\ testLongSubtraction()
8
+comment3.params=
9
+comment3.target=void\ testShortSubtraction()
10
+comment4.params=
11
+comment4.target=void\ testByteSubtraction()
12
+comment5.params=
13
+comment5.target=void\ testFloatSubtraction()
14
+comment6.params=
15
+comment6.target=void\ testDoubleSubtraction()
16
+numComments=7

+ 80
- 0
TestSubtraction.java View File

1
+import org.junit.Test;
2
+
3
+import static org.junit.Assert.assertEquals;
4
+
5
+/**
6
+ * @author leon on 8/26/18.
7
+ */
8
+public class TestSubtraction {
9
+    private static volatile MathUtilities mathUtils = new MathUtilities();
10
+
11
+
12
+    @Test
13
+    public void testIntegerSubtraction(){
14
+        // : Given
15
+        int baseValue = 20;
16
+        int difference = 7;
17
+        int expectedInt = 13;
18
+        // : When
19
+        int actualInt = mathUtils.subtract(baseValue,difference);
20
+        // : Then
21
+        assertEquals(expectedInt,actualInt);
22
+    }
23
+    @Test
24
+    public void testLongSubtraction() {
25
+        // : Given
26
+        long baseValue = 228437266;
27
+        long difference = 228437265;
28
+        long expectedLong = 1;
29
+        // : When
30
+        long actualLong = mathUtils.subtract(baseValue, difference);
31
+        // : Then
32
+        assertEquals(expectedLong,actualLong);
33
+    }
34
+    @Test
35
+    public void testShortSubtraction() {
36
+        // : Given
37
+        short baseValue = 16384;
38
+        short difference = 16383;
39
+        short expectedShort = 1;
40
+        // : When
41
+        short actualShort = mathUtils.subtract(baseValue, difference);
42
+        // : Then
43
+        assertEquals(expectedShort,actualShort);
44
+    }
45
+    @Test
46
+    public void testByteSubtraction() {
47
+        // : Given
48
+        byte baseValue = 63;
49
+        byte difference = 64;
50
+        byte expectedByte = -1;
51
+        // : When
52
+        byte actualByte = mathUtils.subtract(baseValue, difference);
53
+        // : Then
54
+        assertEquals(expectedByte,actualByte);
55
+    }
56
+    @Test
57
+    public void testFloatSubtraction() {
58
+        // : Given
59
+        float baseValue = 750.585F;
60
+        float difference = 795.0F;
61
+        float expectedFloat = -44.415F;
62
+        // : When
63
+        float actualFloat = mathUtils.subtract(baseValue,difference);
64
+        // : Then
65
+        assertEquals(expectedFloat,actualFloat, 0.005);
66
+    }
67
+    @Test
68
+    public void testDoubleSubtraction() {
69
+        // : Given
70
+        double baseValue = 225.25;
71
+        double difference = 231;
72
+        double expectedDouble = -5.75;
73
+        // : When
74
+        double actualDouble = mathUtils.subtract(baseValue, difference);
75
+        // : Then
76
+        assertEquals(expectedDouble,actualDouble, 0);
77
+    }
78
+
79
+
80
+}

+ 25
- 19
package.bluej View File

4
 editor.fx.0.x=0
4
 editor.fx.0.x=0
5
 editor.fx.0.y=0
5
 editor.fx.0.y=0
6
 objectbench.height=129
6
 objectbench.height=129
7
-objectbench.width=1171
8
-package.divider.horizontal=0.6
9
-package.divider.vertical=0.7490774907749077
10
-package.editor.height=399
11
-package.editor.width=1069
12
-package.editor.x=59
13
-package.editor.y=63
14
-package.frame.height=600
15
-package.frame.width=1195
7
+objectbench.width=531
8
+package.divider.horizontal=0.6397146254458977
9
+package.divider.vertical=0.8697318007662835
10
+package.editor.height=901
11
+package.editor.width=727
12
+package.editor.x=1440
13
+package.editor.y=0
14
+package.frame.height=1080
15
+package.frame.width=861
16
 package.numDependencies=0
16
 package.numDependencies=0
17
 package.numTargets=6
17
 package.numTargets=6
18
 package.showExtends=true
18
 package.showExtends=true
27
 target1.name=PredicateUtilities
27
 target1.name=PredicateUtilities
28
 target1.showInterface=false
28
 target1.showInterface=false
29
 target1.type=ClassTarget
29
 target1.type=ClassTarget
30
+target1.typeParameters=
30
 target1.width=130
31
 target1.width=130
31
 target1.x=280
32
 target1.x=280
32
 target1.y=120
33
 target1.y=120
34
 target2.name=StringUtilitiesTest
35
 target2.name=StringUtilitiesTest
35
 target2.showInterface=false
36
 target2.showInterface=false
36
 target2.type=UnitTestTargetJunit4
37
 target2.type=UnitTestTargetJunit4
38
+target2.typeParameters=
37
 target2.width=140
39
 target2.width=140
38
 target2.x=490
40
 target2.x=490
39
 target2.y=70
41
 target2.y=70
41
 target3.name=MathUtilities
43
 target3.name=MathUtilities
42
 target3.showInterface=false
44
 target3.showInterface=false
43
 target3.type=ClassTarget
45
 target3.type=ClassTarget
46
+target3.typeParameters=
44
 target3.width=100
47
 target3.width=100
45
 target3.x=60
48
 target3.x=60
46
 target3.y=150
49
 target3.y=150
47
 target4.height=50
50
 target4.height=50
48
-target4.name=StringUtilities
51
+target4.name=PredicateUtilitiesTest
49
 target4.showInterface=false
52
 target4.showInterface=false
50
-target4.type=ClassTarget
51
-target4.width=110
52
-target4.x=500
53
-target4.y=130
53
+target4.type=UnitTestTargetJunit4
54
+target4.typeParameters=
55
+target4.width=160
56
+target4.x=260
57
+target4.y=50
54
 target5.height=50
58
 target5.height=50
55
-target5.name=PredicateUtilitiesTest
59
+target5.name=StringUtilities
56
 target5.showInterface=false
60
 target5.showInterface=false
57
-target5.type=UnitTestTargetJunit4
58
-target5.width=160
59
-target5.x=260
60
-target5.y=50
61
+target5.type=ClassTarget
62
+target5.typeParameters=
63
+target5.width=110
64
+target5.x=500
65
+target5.y=130
61
 target6.height=50
66
 target6.height=50
62
 target6.name=MathUtilitiesTest
67
 target6.name=MathUtilitiesTest
63
 target6.showInterface=false
68
 target6.showInterface=false
64
 target6.type=UnitTestTargetJunit4
69
 target6.type=UnitTestTargetJunit4
70
+target6.typeParameters=
65
 target6.width=130
71
 target6.width=130
66
 target6.x=50
72
 target6.x=50
67
 target6.y=90
73
 target6.y=90