-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathMathUtilitiesHalfTest.java
More file actions
57 lines (39 loc) · 1000 Bytes
/
MathUtilitiesHalfTest.java
File metadata and controls
57 lines (39 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class MathUtilitiesHalfTest {
private MathUtilities utilities;
private static final double DELTA = 0.009; // allows a margin of error
@Before
public void setup(){
utilities = new MathUtilities();
}
@Test
public void test1(){
//Given
double expected = 2.0;
//When
double actual = utilities.half(4);
//Then
assertEquals(expected, actual, DELTA);
}
@Test
public void test2(){
//Given
double expected = 4;
//When
double actual = utilities.half(8);
//Then
assertEquals(expected, actual, DELTA);
}
@Test
public void test3(){
//Given
double expected = 8;
//When
double actual = utilities.half(16);
//Then
assertEquals(expected, actual, DELTA);
}
}