-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestDoubleChain.java
More file actions
37 lines (30 loc) · 995 Bytes
/
Copy pathTestDoubleChain.java
File metadata and controls
37 lines (30 loc) · 995 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
import static org.junit.Assert.*;
import org.junit.Test;
/** Perform tests of the DoubleChain class
*/
public class TestDoubleChain {
/** Tests the constructor of DoubleChain */
@Test
public void testConstructor() {
DoubleChain d = new DoubleChain(5);
assertEquals(5,d.getFront().val, 1e-6);
assertEquals(null, d.getFront().prev);
assertEquals(null, d.getFront().next);
}
/** Tests some basic DoubleChain operations. */
@Test
public void testBasicOperations() {
DoubleChain d = new DoubleChain(5);
assertEquals(5, d.getFront().val, 1e-11);
assertEquals(5, d.getBack().val, 1e-11);
d.insertFront(2);
d.insertFront(1);
d.insertBack(7);
d.insertBack(8);
assertEquals(1, d.getFront().val, 1e-11);
assertEquals(8, d.getBack().val, 1e-11);
}
public static void main(String[] args) {
jh61b.junit.textui.runClasses(TestDoubleChain.class);
}
}