Skip to content

testing: additional testcases for CountSinglyLinkedListRecursionTest #6392

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
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,39 @@ public void testCountWithDuplicateElements() {
list.insert(3);
assertEquals(5, list.count(), "Count of a list with duplicate elements should match total node count.");
}

@Test
public void testCountAfterClearingList() {
for (int i = 1; i <= 4; i++) {
list.insert(i);
}
list.clear(); // assuming you have a clear method; if not, skip this
assertEquals(0, list.count(), "Count after clearing the list should be 0.");
}

@Test
public void testCountOnVeryLargeList() {
int n = 1000;
for (int i = 0; i < n; i++) {
list.insert(i);
}
assertEquals(n, list.count(), "Count should correctly return for large list sizes.");
}

@Test
public void testCountOnListWithNegativeNumbers() {
list.insert(-1);
list.insert(-5);
list.insert(-10);
assertEquals(3, list.count(), "Count should correctly handle negative values.");
}

@Test
public void testCountIsConsistentWithoutModification() {
list.insert(1);
list.insert(2);
int firstCount = list.count();
int secondCount = list.count();
assertEquals(firstCount, secondCount, "Repeated count calls should return consistent values.");
}
}
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