The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 131 -- Algorithms and Data Structures I
Lab #2
For labs meeting on Sep. 7 and 10, 2001

This exercise will help you learn to write a test plan for a package, and a package test program.

Chapter 2 of the data structures book gives a package called Dates. Study this package. Develop a plan to test Dates, and a test program that implements the plan. You will actually need two test programs.

  1. Test to ensure that only the package-provided operations on Date values. That is, the program will attempt to use "bogus" Date operations like adding two times together, multiplying a Date by a constant, etc. Also test to ensure that a private type is really private, that is, that a client program cannot directly access the fields of a Date value. If all is well with the compiler, this program will fail to compile; a successful test will result in a number of compilation error messages.
  2. Test to ensure that the package-provided operations behave properly.
This is not a full-scale project, just a lab exercise, so if you won't be able to complete the test program during the lab time, try to get a part of it working, so that you understand the issues in writing test programs. This will help you greatly in forthcoming labs and projects!