Testing Correctness

  • Explain the need for testing the implementations of an ADT.

How do we know our implementation of IndexedList in ArrayIndexedList is "correct"?

Correctness here means each operation behaves as expected for all inputs, including the edge cases.

Well, the least we can do is to test our implementation.

Through testing, we discover errors in our implementations. Moreover, we build confidence in the correctness of our code when testing does not find errors.

When we declare an ADT, we should provide a suite of tests alongside it. As an added advantage, tests further clarify the specification of operations.

In this course, testing is a first-class citizen! It is as important as the design and implementation of ADTs.