99 {
100 unsigned int k;
101
102
103
104
106 ZMlogger().
emit(
"---------- Begin testing: ----------\n" );
108 ZMlogger().
emit(
"This message checks out basic logger behavior\n" );
109
110
111
112
113
116 "---------- Testing default informational behavior: ----------\n" );
118 ZMthrow( ZMxInfo(
"Testing default informational exception behavior" ) );
119
120
121
122
123
126 "---------- Testing default ostringstream behavior 3 times: ----------\n" );
127 std::ostringstream oss;
128 oss << "Accumulated numbers are ";
129 for ( k = 0; k < 3; ++k ) {
131 if ( k > 0 )
132 oss << ", ";
133 oss << k;
135 }
136
137
138
139
142 "---------- Testing default ignoring behavior 3 times: ----------\n" );
143 for ( k = 0; k < 3; ++k ) {
145 string testMesg = "Testing default exception ignoring behavior #";
147 }
148
149
150
151
152
155 "---------- Testing defined ignoring behavior 3 times: ----------\n" );
156 for ( k = 0; k < 3; ++k ) {
158 string testMesg = "Testing defined exception ignoring behavior #";
160 }
161
162
163
164
167 "---------- Testing default throwing behavior 3 times: ----------\n" );
168 for ( k = 0; k < 3; ++k ) {
170 string testMesg = "Testing default exception throwing behavior #";
171#ifndef DEFECT_NO_EXCEPTIONS
172 try {
173#endif
175#ifndef DEFECT_NO_EXCEPTIONS
176 }
178 std::cerr <<
"Caught: " << e.
name() <<
"\n";
179 }
180#endif
181 }
182
183
184
185
186
189 "---------- Testing forced throwing behavior 3 times: ----------\n" );
191 for ( k = 0; k < 3; ++k ) {
193 string testMesg = "Testing forced exception throwing behavior #";
194#ifndef DEFECT_NO_EXCEPTIONS
195 try {
196#endif
198#ifndef DEFECT_NO_EXCEPTIONS
199 }
201 std::cerr <<
"Caught: " << e.
name() <<
"\n";
202 }
203#endif
204 }
205
206
207
208
211 "---------- Testing scheduled throwing behavior 3 times: ----------\n" );
213 for ( k = 0; k < 3; ++k ) {
215 string testMesg = "Testing scheduled exception throwing behavior #";
216#ifndef DEFECT_NO_EXCEPTIONS
217 try {
218#endif
220#ifndef DEFECT_NO_EXCEPTIONS
221 }
223 std::cerr <<
"Caught: " << e.
name() <<
"\n";
224 }
225#endif
226 }
227
228
229
230
231
232
233
234
236 ZMlogger().
emit(
"---------- Test exception history: ----------\n" );
237
241 + " exceptions were recorded (most recent first):\n"
242 );
245
246 const int NEWMAX = 4;
251 + " );"
252 );
253
254 ZMlogger().
emit(
string(
" we now have record of these " )
256 + " exceptions:\n"
257 );
260
261
262
263
264 return 0;
265
266}
#define ZMthrow(userExcept)
unsigned int setMax(unsigned int limit)
unsigned int size() const
const ZMexception * get(unsigned int k=0) const
void display(const ZMexception *ex)