/* testLinkT.cpp */ #include #include "linkListT.h" // prototypes void TestIntegerList(); void TestDoubleList(); int main() { cout << "Testing integer list:\n" << endl; TestIntegerList(); cout << "\n------------------------------------\n" << endl; cout << "Testing real list:\n" << endl; TestDoubleList(); return 0; } void TestIntegerList() { LinkedList list1 ; // add some initial nodes list1.AddNode( 3 ); list1.AddNode( 5 ); cout << "Initial contents of list1:" << endl; list1.ShowNodes(); // add a few more nodes list1.AddNode( 1 ); cout << "Contents of list1 after adding:" << endl; list1.ShowNodes(); // delete a few nodes list1.DeleteNode( 5 ); cout << "Contents of list1 after deleting:" << endl; list1.ShowNodes(); } void TestDoubleList() { LinkedList listD ; // add some initial nodes listD.AddNode( 3.3 ); listD.AddNode( 5.4 ); listD.AddNode( 7.2 ); cout << "Initial contents of listD:" << endl; listD.ShowNodes(); // add a few more nodes listD.AddNode( 1.1 ); cout << "Contents of listD after adding:" << endl; listD.ShowNodes(); // delete a few nodes listD.DeleteNode( 5.4 ); listD.DeleteNode( 3.3 ); cout << "Contents of listD after deleting:" << endl; listD.ShowNodes(); }