style: format code (#4212)

close #4204
This commit is contained in:
acbin
2023-06-09 18:52:05 +08:00
committed by GitHub
parent ad03086f54
commit 00282efd8b
521 changed files with 5233 additions and 7309 deletions

View File

@@ -1,29 +1,26 @@
package com.thealgorithms.datastructures.queues;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class LinkedQueueTest {
@Test
public void testQue() {
LinkedQueue<Integer> queue = new LinkedQueue<>();
for (int i = 1; i < 5; i++)
queue.enqueue(i);
@Test
public void testQue() {
LinkedQueue<Integer> queue = new LinkedQueue<>();
for (int i = 1; i < 5; i++) queue.enqueue(i);
assertEquals(queue.peekRear(), 4);
assertEquals(queue.peek(2), 2);
assertEquals(queue.peekRear(), 4);
assertEquals(queue.peek(2), 2);
assertEquals(queue.peek(4), 4);
assertEquals(queue.peek(4), 4);
final int[] element = { 1 };
final int[] element = {1};
// iterates over all the elements present
// as in the form of nodes
queue.forEach(integer -> {
if (element[0]++ != integer)
throw new AssertionError();
});
}
// iterates over all the elements present
// as in the form of nodes
queue.forEach(integer -> {
if (element[0]++ != integer) throw new AssertionError();
});
}
}

View File

@@ -26,7 +26,7 @@ class PriorityQueuesTest {
myQueue.insert(5);
myQueue.insert(3);
myQueue.insert(10);
myQueue.remove();
Assertions.assertEquals(myQueue.peek(), 5);
myQueue.remove();
@@ -46,7 +46,7 @@ class PriorityQueuesTest {
myQueue.insert(10);
Assertions.assertEquals(myQueue.isEmpty(), false);
Assertions.assertEquals(myQueue.isFull(), true);
myQueue.remove();
Assertions.assertEquals(myQueue.getSize(), 3);
Assertions.assertEquals(myQueue.peek(), 5);