//tstring3.cpp //test driver for class String with operator functions #include "string3.h" #include void write_string(String&, char *); void test_assgn(char *, char *); void test_cat(char *, char *); void test2_cat(char *, char *); void test_equal(char *, char *); void test_subscr(String&, int ); void test2_subscr(String&, int ); main() { cout<<"\t\tTest for constructors and method String::getlength\n\n"; String S; String S1("Summer"); String S2(""); String *S3 = new String("Very hot summer"); String S4(S); cout<<" --default:\n"; write_string(S, "S"); cout<<" --convert:\n"; write_string(S1, "S1"); write_string(S2, "S2"); write_string(*S3, "S3"); cout<<" --copy:\n"; write_string(S4, "S4"); cout<<"\n\t\tTest for assignment operator\n\n"; test_assgn("", "structure"); test_assgn("data", "structure"); test_assgn("data", ""); cout<<"\n\t\tTest for concatenation operator =+ \n\n"; test_cat("", "structure"); test_cat("data", "structure"); test_cat("structure", ""); test_cat("", ""); cout<<"\n\t\tTest for concatenation operator + \n\n"; test2_cat("", "structure"); test2_cat("data", "structure"); test2_cat("structure", ""); test2_cat("", ""); cout<<"\n\t\tTest for equality operator \n\n"; test_equal("structure", "structure"); test_equal("structure", "Structure"); test_equal("structure", "test"); test_equal("", "test"); test_equal("", ""); test_equal("test", ""); cout<<"\n\t\tTest for subscript operator\n\n"; write_string(S1, "S"); test_subscr(S1, 0); test_subscr(S1, 3); test_subscr(S1, 5); test_subscr(S1, 6); write_string(S, "S1"); test_subscr(S, 0); test_subscr(S, 3); cout<<"\n\t\tAnother test for subscript operator\n\n"; write_string(S1, "S"); test2_subscr(S1, 0); test2_subscr(S1, 2); test2_subscr(S1, 5); test2_subscr(S1, 10); write_string(S2, "S1"); test2_subscr(S2, 0); test2_subscr(S2, 3); cout<<"\n\t\tTest for input operator\n\n"; String R; cout<<"Please enter string up to 255 characters " <<"and press Enter:\n"; cin>>R; cout<<"You entered:\n"<>R; cout<<"You entered:\n"<