-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataStructuresTests.java
More file actions
43 lines (36 loc) · 1.23 KB
/
Copy pathDataStructuresTests.java
File metadata and controls
43 lines (36 loc) · 1.23 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
import org.junit.Test;
import org.junit.Before;
import DataStructures.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class DataStructuresTests {
MyPriorityQueue pq;
@Before
public void init() {
pq = new MyPriorityQueue();
}
/** Adds and removes one item. **/
@Test
public void insertOne() {
pq.insert("Axolotl", 100);
assertEquals("Size should be 1", 1, pq.size());
assertEquals("Max item should be \"Axolotl\" when peeking.",
"Axolotl", pq.peek());
assertEquals("Max item should be \"Axolotl\" when removing.",
"Axolotl", pq.removeMax());
}
/** Create more tests here! The above test is not comprehensive. */
@Test
public void insertTest() {
pq.insert("Axolotl", 100);
pq.insert("Axolotl", 100);
pq.insert("Axolotl", 100);
pq.insert("Axolotl", 100);
pq.insert("Axolotl", 100);
assertEquals("Size should be 1", 1, pq.size());
assertEquals("Max item should be \"Axolotl\" when peeking.",
"Axolotl", pq.peek());
assertEquals("Max item should be \"Axolotl\" when removing.",
"Axolotl", pq.removeMax());
}
}