-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoveToFrontListTests.java
More file actions
49 lines (45 loc) · 1.38 KB
/
Copy pathMoveToFrontListTests.java
File metadata and controls
49 lines (45 loc) · 1.38 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
import static org.junit.Assert.*;
import org.junit.Test;
//import wsuv.autolab.Score;
public class MoveToFrontListTests {
@Test
// @Score(1)
public void testFindOnEmptyList() {
MoveToFrontList l = new MoveToFrontList();
assertNull("I should't find anything in an empty list!", l.find(""));
}
@Test
// @Score(1)
public void testSizeOnEmptyList() {
MoveToFrontList l = new MoveToFrontList();
assertEquals("Size of empty list should be 0", 0, l.size());
}
@Test
// @Score(1)
public void testRankWithNoItems() {
MoveToFrontList l = new MoveToFrontList();
assertEquals("Size of empty list should be 0", 0, l.size());
assertEquals("Check the rank for an empty list...",
0, l.rank("Hi"));
}
@Test
// @Score(1)
public void testAddOneItem() {
MoveToFrontList l = new MoveToFrontList();
l.incrementCount("Hi");
assertEquals("Adding to the list with incrementCount is broken, or size() returns a bad value",
1, l.size());
}
@Test
// @Score(1)
public void testRankWithOneItem() {
MoveToFrontList l = new MoveToFrontList();
l.incrementCount("Hi");
assertEquals("Adding to the list with incrementCount is broken, or size() returns a bad value",
1, l.size());
assertEquals("The rank of a your first item should be 0",
0, l.rank("Hi"));
assertEquals("The rank of an item not in the list should be 1 here.",
1, l.rank("Hip"));
}
}