// File: simpleStringTest.cpp // Tests the simpleString class #include "simpleString.h" #include using namespace std; void testSimpleString(); simpleString testSimpleStringPart2 (simpleString &); int main() { testSimpleString(); } // Prompts for input string and uses it to test the // simpleString class. void testSimpleString () { simpleString aString; // to be initialized from user input simpleString anotherString; // initialized by copy constructor // read in a string. cout << "Enter a string and press RETURN: "; aString.readString(); // test copy constructor and assignment operator anotherString = testSimpleStringPart2 (aString); // repeat tests on copy testSimpleStringPart2 (anotherString); } simpleString testSimpleStringPart2 (simpleString & aString) { // test copy constructor and assignment operator simpleString anotherString = aString; // display the string just read. cout << "The string read was: "; aString.writeString(); cout << endl; // display each character on a separate line. cout << "The characters in the string follow:" << endl; for (int pos = 0; pos < aString.getLength(); pos++) cout << aString.at(pos) << endl; // test of copy constructor and destructor return anotherString; }