Skip to content

Commit 093e352

Browse files
committed
Added tests
1 parent a54b11b commit 093e352

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.thealgorithms.datastructures.queues;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.assertEquals;
6+
7+
8+
class LinkedQueueTest {
9+
@Test
10+
public void testQue() {
11+
LinkedQueue<Integer> queue = new LinkedQueue<>();
12+
for (int i = 1; i < 5; i++)
13+
queue.enqueue(i);
14+
15+
assertEquals(queue.peekRear(), 4);
16+
assertEquals(queue.peek(2), 2);
17+
18+
assertEquals(queue.peek(4), 4);
19+
20+
final int[] element = { 1 };
21+
22+
queue.forEach(integer -> {
23+
if (element[0]++ != integer)
24+
throw new AssertionError();
25+
});
26+
}
27+
}

0 commit comments

Comments
 (0)