forked from ucsd-cse15l-w23/lab3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedListTests.java
More file actions
55 lines (49 loc) · 1.16 KB
/
LinkedListTests.java
File metadata and controls
55 lines (49 loc) · 1.16 KB
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
import static org.junit.Assert.*;
import org.junit.*;
public class LinkedListTests {
@Test
public void testAppend(){
LinkedList ll = new LinkedList();
ll.append(2);
assertEquals(2,ll.root.value);
}
@Test
public void testPrepend(){
LinkedList ll = new LinkedList();
ll.append(2);
ll.prepend(4);
assertEquals(4,ll.root.value);
}
@Test
public void testFirst(){
LinkedList ll = new LinkedList();
ll.append(2);
ll.prepend(4);
ll.prepend(6);
assertEquals(6,ll.first());
}
@Test
public void testLast(){
LinkedList ll = new LinkedList();
ll.append(2);
ll.prepend(4);
ll.prepend(6);
assertEquals(2,ll.last());
}
@Test
public void testToString(){
LinkedList ll = new LinkedList();
ll.append(2);
ll.prepend(4);
ll.prepend(6);
assertEquals("2 4 6 ",ll.toString());
}
@Test
public void testLength(){
LinkedList ll = new LinkedList();
ll.append(2);
ll.prepend(4);
ll.prepend(6);
assertEquals(3,ll.length());
}
}