Testing Correctness
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 discover 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 design and implementations of ADTs.