ECE 250 students are not required to know this.
The heart of the the tester-driver testing environment for ECE 250 is the virtual class Tester. This class may be viewed here. This implements a simple command-line interpreter by means of the member function void run() which reads commands from console input and then interprets them appropriately. It may do so immediately or through the help of the member function void process().
The tester class has two class members:
There are two global variables which are also used for tracking. These cannot be static members as they must be shared by all instances of derived classes of Tester. These are stored within the dwharder/Algorithms_and_Data_Structures namespace.
The void process() function is virtual and must be defined in any derived class of the tester class.
The constructor optionally takes one argument which is an instance of the object to be tested. If such an argument is not passed, then the object being tested is set to zeros and must be explicitly initialized as a result of a command provided by the user.
One command standard with any object is new which simply assigns:
object = new Type();
When the function void run() is executed, it begins reading standard input for a string. It does this in an infinite loop and only breaks out as a result of specific input. The sequence for the infinite loop is as follows:
If the next character of console input is an end-of-file character, the test run ends: return;.
The command !! may be used by the user to mean the previous command, thus, if the user previously used push_front, the user could now use !! instead of typing the entire expression out again.
The command !N where N is an integer is interpreted as meaning use the Nth command, where N is any integer greater than or equal to 1 and less than the current command number.
Once any historical commands are interpreted, the current command is stored in the history.
The following key commands are recognized by run():
If the command is not recognized as one of the above key commands, then the process() function is called. This must be defined within any derived class and calls member functions as appropriate to the class being tested. This command must indicate to the user if a command is not recognized.
The form of the member function void process() is described under Derived Tester Classes.