21#include "CLHEP/Cast/itos.h"
39#ifdef DEFECT_NO_EXCEPTIONS
42 ZMlogger().emit( "Note: exception would have been correctly thrown here\n" );
45 ZMlogger().emit( "Note: exception would have been correctly thrown here\n" );
87 +
" " + (ex->
wasThrown() ?
"thrown" :
"ignored")
101 ZMlogger().
emit(
"---------- Begin testing: ----------\n" );
103 ZMlogger().
emit(
"This message checks out basic logger behavior\n" );
111 "---------- Testing default informational behavior: ----------\n" );
113 ZMthrow( ZMxInfo(
"Testing default informational exception behavior" ) );
121 "---------- Testing default ostringstream behavior 3 times: ----------\n" );
122 std::ostringstream oss;
123 oss <<
"Accumulated numbers are ";
124 for ( k = 0; k < 3; ++k ) {
137 "---------- Testing default ignoring behavior 3 times: ----------\n" );
138 for ( k = 0; k < 3; ++k ) {
140 string testMesg =
"Testing default exception ignoring behavior #";
150 "---------- Testing defined ignoring behavior 3 times: ----------\n" );
151 for ( k = 0; k < 3; ++k ) {
153 string testMesg =
"Testing defined exception ignoring behavior #";
162 "---------- Testing default throwing behavior 3 times: ----------\n" );
163 for ( k = 0; k < 3; ++k ) {
165 string testMesg =
"Testing default exception throwing behavior #";
166#ifndef DEFECT_NO_EXCEPTIONS
170#ifndef DEFECT_NO_EXCEPTIONS
173 std::cerr <<
"Caught: " << e.
name() <<
"\n";
184 "---------- Testing forced throwing behavior 3 times: ----------\n" );
186 for ( k = 0; k < 3; ++k ) {
188 string testMesg =
"Testing forced exception throwing behavior #";
189#ifndef DEFECT_NO_EXCEPTIONS
193#ifndef DEFECT_NO_EXCEPTIONS
196 std::cerr <<
"Caught: " << e.
name() <<
"\n";
206 "---------- Testing scheduled throwing behavior 3 times: ----------\n" );
208 for ( k = 0; k < 3; ++k ) {
210 string testMesg =
"Testing scheduled exception throwing behavior #";
211#ifndef DEFECT_NO_EXCEPTIONS
215#ifndef DEFECT_NO_EXCEPTIONS
218 std::cerr <<
"Caught: " << e.
name() <<
"\n";
231 ZMlogger().
emit(
"---------- Test exception history: ----------\n" );
236 +
" exceptions were recorded (most recent first):\n"
241 const int NEWMAX = 4;
249 ZMlogger().
emit(
string(
" we now have record of these " )
#define ZMthrow(userExcept)
unsigned int setMax(unsigned int limit)
unsigned int size() const
const ZMexception * get(unsigned int k=0) const
ZMexLogResult emit(const ZMexception &exc)
std::string handlerUsed() const
std::string message() const
virtual std::string name() const
ZMexStandardDefinition(ZMexception, ZMxTest)
void display(const ZMexception *ex)