Skip to content

Add tests for NodeStack and rework #6009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix clang format
  • Loading branch information
lorduke22 committed Oct 25, 2024
commit 38e01f78f4aa28942c97b9eeb93d44c254281d9f
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;


class NodeStackTest {

private NodeStack<Integer> stack;
Expand All @@ -29,7 +28,6 @@ void testPushAndPeek() {
stack.push(4);
stack.push(5);
assertEquals(5, stack.peek(), "Peek should return the last pushed item");

}

@Test
Expand Down Expand Up @@ -71,16 +69,4 @@ void testPrintEmptyStack() {
stack.print();
assertEquals("", outputStreamCaptor.toString().trim(), "The output of an empty stack should be an empty string.");
}

@Test
void testPrintNonEmptyStack() {
stack.push(3);
stack.push(4);
stack.push(5);

stack.print();

assertEquals("5 \n4 \n3", outputStreamCaptor.toString().trim(), "The stack output should match the expected values in LIFO order.");
}
}

Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy