34 #define PGTESTXX_VERSION \ 35 "PGTESTXX V1.0 test functions within the PGPLOT++ library" 39 #include <tfxx/commandline.h> 59 for (
int i=0; i<s.length(); ++i) { cout << c; }
66 #define CODE( line ) \ 68 cout.setf(std::ios_base::left, std::ios_base::adjustfield); \ 69 cout << endl << std::string(#line)+std::string(";") << ": "; line 71 #define ILLEGAL( line ) \ 72 cout << "ILLEGAL (does not compile): " << #line << ";" << endl; 82 { cout <<
"destructor of Handletestbaseclass: "; this->
print(cout); }
83 virtual void print(std::ostream& os)
const 84 { cout <<
"Handletestbaseclass(" <<
Mval <<
")" << endl; }
97 { cout <<
"destructor of Handletestclass: "; this->
print(cout); }
98 virtual void print(std::ostream& os)
const 100 cout <<
"Handletestclass(" << this->
basevalue() <<
"," 101 <<
Mval <<
")" << endl;
112 subsection(
"in function that accepts an instance of Handle<Handletestbaseclass>::Tcoc");
113 CODE( h->print(cout) );
114 ILLEGAL( h->basevalue()=60; )
126 CODE( H1->value()=8 );
127 CODE( H1->print(cout) );
128 subsection(
"create handle to base from handle");
130 CODE( H1->basevalue()=9 );
131 CODE( H1->print(cout) );
132 CODE( H2->print(cout) );
133 CODE( H1->value()=-20 );
134 CODE( H2->basevalue()=-5 );
135 CODE( H2->print(cout) );
136 ILLEGAL( H2->value()=18 );
142 CODE( H5->print(cout) );
143 ILLEGAL( H5->basevalue()=-8 );
146 subsection(
"assignement using inheritance transparency");
147 CODE( H4->print(cout) );
149 CODE( H4->print(cout) );
150 CODE( H4->basevalue()=100 );
151 CODE( H3->print(cout) );
153 CODE( H6->print(cout) );
155 CODE( H6->print(cout) );
156 ILLEGAL( H6->basevalue()=64 );
162 int main(
int iargc,
char* argv[])
168 PGTESTXX_VERSION
"\n" 169 "usage: pgtestxx [-all] [-handle]" "\n" 170 " or: pgtestxx --help|-h" "\n" 177 "-all run all tests" "\n" 178 "-handle test Handle class template" "\n" 182 using namespace tfxx::cmdline;
183 static Declare options[]=
188 {
"verbose",arg_no,
"-"},
190 {
"handle",arg_no,
"-"},
199 cerr << usage_text << endl;
204 Commandline cmdline(iargc, argv, options);
207 if (cmdline.optset(0))
209 cerr << usage_text << endl;
210 cerr << help_text << endl;
239 cout << PGTESTXX_VERSION << endl;
240 if (cmdline.optset(2) || cmdline.optset(3)) {
testhandle(); }
void printtitle(const std::string &s, const char &c)
virtual ~Handletestbaseclass()
void subsection(const std::string &s)
virtual ~Handletestclass()
void testhandlefunction(const pgplot::Handle< Handletestbaseclass >::Tcoc &h)
Test function for inheritance transparency.
Handletestclass(const int &i, const int &j)
C++ interface for PGPLOT.
Handletestbaseclass Tbase
virtual void print(std::ostream &os) const
void section(const std::string &s)
Base class for testing handles.
Handletestbaseclass(const int &i)
int main(int iargc, char *argv[])
const char *const usage_escape_sequences
usage text for escape sequences
A handle class used within the PGPLOT++ library (prototypes)
void testhandle()
Test handles.
virtual void print(std::ostream &os) const