An automatic testing and grading method for a C++ list class

  • Authors:
  • Lewis E. Hitchner

  • Affiliations:
  • California Polytechnic State University, San Luis Obispo, California

  • Venue:
  • ACM SIGCSE Bulletin
  • Year:
  • 1999

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper presents a scheme for automatic grading of the member functions of a C++ list class. Developing an automatic grading program for C++ classes is non-trivial because a test case to verify one member function of the class may depend upon the correctness of one or more other class member functions. In addition, performing multiple test cases in the same driver program may produce invalid grading outcomes because an erroneous result from one test case could violate the preconditions for a later test case. The method described here uses a weakness of C++ data encapsulation that allows access to private data members of an object. Two instances of a list object are constructed, tested, and compared using student designed and instructor designed classes. If a test case produces incorrect results using the student's class, the instructor written class may be used (via a type cast) to access the private data members of the student's list object to correct the errors. The grading program automatically reports and tallies errors for each member function and for the class total.