4 * Code to test the Cstring ADT
5 * Has no purify errors.
6 * Presents examples of use of class Cstring
8 * Verified output is in cstring_out
10 * $Log: CstringTest.C,v $
11 * Revision 1.1 1994/08/17 18:26:10 markc
12 * Code and sample output to test new classes.
18 #pragma implementation "cstring.h"
19 #include "../h/cstring.h"
23 Cstring one, two, three("happy");
24 Cstring *p1, *p2, *p3;
26 p1 = new Cstring("sad");
28 p2 = new Cstring(one);
32 cout << "three == happy\n";
35 cout << "one == p1\n";
38 cout << "one == p2\n";
41 cout << one << " is < " << (*p2) << endl;
43 cout << one << " is not < " << (*p2) << endl;
46 cout << one << " is < " << "zippy" << endl;
48 cout << one << " is not < " << "zippy" << endl;
51 cout << one << " is < " << "sade" << endl;
53 cout << one << " is not < " << "sade" << endl;
56 cout << one << " is < " << "sa" << endl;
58 cout << one << " is not < " << "sa" << endl;
61 cout << one << " is < " << "sad" << endl;
63 cout << one << " is not < " << "sad" << endl;
66 cout << one << " is > " << (*p2) << endl;
68 cout << one << " is not > " << (*p2) << endl;
71 cout << one << " is > " << "zippy" << endl;
73 cout << one << " is not > " << "zippy" << endl;
76 cout << one << " is > " << "sade" << endl;
78 cout << one << " is not > " << "sade" << endl;
81 cout << one << " is > " << "sad" << endl;
83 cout << one << " is not > " << "sad" << endl;
85 cout << "one is " << one << endl;
86 cout << "two is " << two << endl;
87 cout << "three is " << three << endl;
88 cout << "p1 is " << (*p1) << endl;
89 cout << "p2 is " << (*p2) << endl;
91 cout << "p2 is " << p2->get() << endl;
93 Cstring *p4 = new Cstring(1, p2->get_copy());
94 cout << "p4 is " << (*p4) << endl;
96 p4->use(p4->get_copy());
97 cout << "p4 is " << (*p4) << endl;
99 cout << one << " plus " << two << " = " << (one + two) << endl;
100 cout << one << " plus " << one << " = " << (one + one) << endl;