MsgServiceValidate Class Reference

#include <MsgServiceValidate.h>

List of all members.

Public Member Functions

 MsgServiceValidate ()
 ~MsgServiceValidate ()
bool RunAllTests ()

Private Member Functions

bool TestMsgServiceConstructor ()
bool TestMsgService ()

Detailed Description

Definition at line 10 of file MsgServiceValidate.h.


Constructor & Destructor Documentation

MsgServiceValidate::MsgServiceValidate (  ) 

Definition at line 21 of file MsgServiceValidate.cxx.

00021 {}

MsgServiceValidate::~MsgServiceValidate (  ) 

Definition at line 25 of file MsgServiceValidate.cxx.

00025 {}


Member Function Documentation

bool MsgServiceValidate::RunAllTests ( void   ) 

Definition at line 107 of file MsgServiceValidate.cxx.

References MsgFormatValidate::RunAllTests(), MsgOStreamServiceValidate::RunAllTests(), MsgStreamValidate::RunAllTests(), TestMsgService(), and TestMsgServiceConstructor().

Referenced by main().

00108 {
00109   bool passed = true;
00110   MsgFormatValidate mfv;
00111   MsgOStreamServiceValidate mossv;
00112   MsgStreamValidate msv;
00113 
00114   passed &= mfv.RunAllTests();
00115   passed &= mossv.RunAllTests();
00116   passed &= msv.RunAllTests();
00117 
00118   passed &= this->TestMsgServiceConstructor();
00119   passed &= this->TestMsgService();
00120   
00121   return passed;
00122 }

bool MsgServiceValidate::TestMsgService (  )  [private]

Definition at line 45 of file MsgServiceValidate.cxx.

References MsgService::AddCatStream(), MsgService::GetStream(), MsgService::Instance(), Msg::kDebug, Msg::kError, Msg::kFatal, Msg::kInfo, Msg::kVerbose, Msg::kWarning, Munits::ms, MSG, and MsgService::PrintStatistics().

Referenced by RunAllTests().

00046 {
00047   MsgService* ms;
00048   MsgStream* s1;
00049   MsgStream* s2;
00050 
00051   // Check that the service creates streams properly
00052   ms = MsgService::Instance();
00053   s1 = ms->GetStream("St1");  
00054   if (s1==0) {
00055     cout << "testMsgService:: St1 returns zero!\n";
00056     return false;
00057   }
00058   s2 = ms->GetStream("St2");  
00059   if (s2==0) {
00060     cout << "testMsgService:: St2 returns zero!\n";
00061     return false;
00062   }
00063 
00064   // Check the default settings
00065   try {
00066     MSG("AAA",Msg::kVerbose) << "Verbose message to stream AAA\n";
00067     MSG("AAA",Msg::kDebug)   << "Debug message to stream AAA\n";
00068     MSG("AAA",Msg::kInfo)    << "Info message to stream AAA\n";
00069     MSG("AAA",Msg::kWarning) << "Warning message to stream AAA\n";
00070     MSG("AAA",Msg::kError)   << "Error message to stream AAA\n ";
00071     MSG("AAA",Msg::kFatal)   << "Fatal message to stream AAA\n";
00072   }
00073   catch(MSGException) {
00074     cerr << endl << endl;
00075     cerr << "***************** MSGException *****************" << endl;
00076     cerr << "*** MSGException caught (MsgServiceValidate) ***" << endl;
00077     cerr << "***************** MSGException *****************" << endl;
00078     cerr << endl;
00079     MSG("AAA",Msg::kError)   << "Fatal message to stream AAA\n";
00080   }
00081 
00082   // Check the handling of concatenated streams
00083   ms->AddCatStream("cat1.txt", "C11", Msg::kInfo);
00084   ms->AddCatStream("cat1.txt", "C12", Msg::kInfo);
00085 
00086   ms->AddCatStream("cat2.txt", "C21", Msg::kInfo);
00087   ms->AddCatStream("cat2.txt", "C22", Msg::kInfo);
00088 
00089   MSG("St1", Msg::kInfo) << "An Info message to St1\n";
00090   MSG("St2", Msg::kInfo) << "An Info message to St2\n";
00091   MSG("C11", Msg::kInfo) << "An Info message to C11 about cat1\n";
00092   MSG("C12", Msg::kInfo) << "An Info message to C12 about cat1\n";
00093   MSG("C21", Msg::kInfo) << "An Info message to C21 about cat2\n";
00094   MSG("C22", Msg::kInfo) << "An Info message to C22 about cat2\n";
00095 
00096   // Dump information about the message service itself
00097   MSG("Msg",Msg::kInfo) << (*ms);
00098 
00099   // Print message service usage statistics
00100   ms->PrintStatistics();
00101   
00102   return true;
00103 }

bool MsgServiceValidate::TestMsgServiceConstructor (  )  [private]

Definition at line 29 of file MsgServiceValidate.cxx.

References MsgService::Instance(), and Munits::m2.

Referenced by RunAllTests().

00030 {
00031   MsgService* m1;
00032   MsgService* m2;
00033 
00034   m1 = MsgService::Instance();
00035   m2 = MsgService::Instance();
00036 
00037   // MsgService is a singleton so these must be the same
00038   if (m1==m2) return true;
00039 
00040   return false;
00041 }


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1