6

What are some good testcases for a Linked list problem in general? for example test cases for a function which finds and eliminates duplicates and returns the pointer to the first node. Some core cases could be: the function is in c# or Java and not c, c++. Assume all positive integers as nodes of the list.

  • Null
  • Empty List
  • Linked list with a loop
  • List with all dups
  • List with one node or 2 nodes (2 dups)
  • No duplicates
  • The list could encounter integer over flow, incase low memory (depending on 32 bit machine, 64 bit machine)
  • Security testing, language automation, memory issues, performance and stress

What else? expecting outrageous test cases..any experts out there?

RashMans
  • 321
  • 1
  • 4
  • 17
  • Since you mentioned that last bullet about Security, Automation, etc, can you tell us more about the context? – rlb.usa Mar 25 '11 at 19:29

2 Answers2

6

How about these?

  • traversing the list
  • edge cases:
    • traversing an empty list
    • traversing list where 1+ stored values are NULL
  • operations (if applicable):
    • deleting from the list
    • inserting into the list
    • inserting a sub-list into the linked list
    • traversing the list backwards (if doubly-linked list)
  • concurrency tests (if applicable):
    • race condition tests
rlb.usa
  • 14,942
  • 16
  • 80
  • 128
  • 1
    i would also test for lists with one or two nodes as most algos are usually of flavors like saving the next->next and deleting next and son on. – Kakira Mar 27 '11 at 18:42
4
  • Security -> what level of permission is required to use the API, roles etc
  • Memory - > How much memory is consumed when this API is used; Does it affect performance?
  • Compatibility testing - > testing the suite using this API on different platforms, windows, MAC, Unix etc.
  • Stress testing -> Invoke the API by using a master slave architecture and parallel processing on different clients.
  • UI-> If the API has a UI, UI test cases come into picture like usability testing
Rob Kielty
  • 7,958
  • 8
  • 39
  • 51
RashMans
  • 321
  • 1
  • 4
  • 17