Exercises

5-1. Identify test requirements for the constructors and reverse() operators for the Velocity class (see Figure 5.3). Consider the difference in requirements between the contract and defensive programming approaches. Construct the test cases for the requirements you identify.

5-2. Do the same for an elementary class that you have.

5-3. Write a test driver to implement the test cases you constructed in either of the previous exercises. If you are implementing in C++ or Java, you can start with the Tester abstract classes described at the end of this chapter.

5-4. Write a specification for an abstract Tester class that would be useful in ...

Get A Practical Guide to Testing Object-Oriented Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.