next up previous contents
Next: Testing the Delete Operator Up: Using Various SLLIST Objects: Previous: Testing INT_SLLIST Instantiation:

Testing the delete Operator from the Front:

This tests if the delete agent properly removes all of the elements of a constant list leaving an empty list behind.

  {
  int input[10] = {2,2,2};

  cout << "Instantiating List Qaitlin" << endl;
  INT_SLLIST Qaitlin("intQa2");

  cout << endl << "Building Qaitlin List" << endl;
  Qaitlin.build_list(input,3);
  cout << "Qaitlin has " << Qaitlin.get_number_elements() << " elements";
  cout << endl;
  cout << endl << "Qaitlin = " << endl << Qaitlin << endl;

  cout << endl << "Delete the element 2 " << endl;
  Qaitlin.delete_element(2);
  cout << endl << "Qaitlin = " << endl << Qaitlin << endl;
  cout << "Qaitlin has " << Qaitlin.get_number_elements() << " elements";
  }

The corresponding output is:

Instantiating List Qaitlin
In default SLLIST<intQa2> constructor.
Exit default SLLIST<intQa2> constructor.

Building Qaitlin List
In SLLIST<intQa2> build_list.
Exit SLLIST<intQa2> build_list.
Qaitlin has 3 elements

Qaitlin = 
2-->2-->2.

Delete the element 2 
Qaitlin = 
Qaitlin has 0 elements


Entering SLLIST<intQa2> destructor.
Leaving SLLIST destructor.



Jim Peterson
1999-04-22