#include <MsgStreamValidate.h>
Public Member Functions | |
| MsgStreamValidate () | |
| ~MsgStreamValidate () | |
| bool | RunAllTests () |
Private Member Functions | |
| bool | TestMsgStreamConstructors () |
| bool | TestMsgStreamManipulators () |
| bool | TestMsgStreamStreamers () |
|
|
Definition at line 18 of file MsgStreamValidate.cxx. 00018 {}
|
|
|
Definition at line 22 of file MsgStreamValidate.cxx. 00022 {}
|
|
|
Definition at line 170 of file MsgStreamValidate.cxx. References TestMsgStreamConstructors(), TestMsgStreamManipulators(), and TestMsgStreamStreamers(). Referenced by main(), and MsgServiceValidate::RunAllTests(). 00171 {
00172 bool passed = true;
00173
00174 passed &= this->TestMsgStreamConstructors();
00175 passed &= this->TestMsgStreamManipulators();
00176 passed &= this->TestMsgStreamStreamers();
00177
00178 return passed;
00179 }
|
|
|
Definition at line 26 of file MsgStreamValidate.cxx. Referenced by RunAllTests(). 00027 {
00028 bool passed = true;
00029 MsgStream defaultStream;
00030 MsgStream namedStream1("NS1");
00031 MsgStream namedStream2("NS2");
00032
00033 cout << "===== testMsgStreamConstructors\n";
00034 if (&defaultStream == 0 ||
00035 &namedStream1 == 0 ||
00036 &namedStream2 == 0) {
00037 cout << "Constructors Failed\n";
00038 return false;
00039 }
00040
00041 cout << defaultStream;
00042 cout << namedStream1;
00043 cout << namedStream2;
00044
00045 return passed;
00046 }
|
|
|
Definition at line 50 of file MsgStreamValidate.cxx. References MsgStream::AddFormat(), MsgStream::AttachOStream(), MsgStream::DetachOStream(), MsgStream::RemoveFormat(), s(), MsgStream::SetFormat(), and MsgStream::SetLogLevel(). Referenced by RunAllTests(). 00051 {
00052 bool passed = true;
00053 int i;
00054 MsgStream s("MS1");
00055 Msg::LogLevel_t lvl;
00056
00057 cout << "===== testMsgStreamManipulators\n";
00058 cout << "Default Stream:\n";
00059 cout << s;
00060
00061 cout << "SetLogLevel:\n";
00062 s.SetLogLevel(Msg::kVerbose);
00063 cout << s;
00064
00065 cout << "SetFormat:\n";
00066 for (i=Msg::kMinLogLevel; i<Msg::kNLogLevel; ++i) {
00067 lvl = (Msg::LogLevel_t)i;
00068 s.SetFormat(lvl, Msg::kPriority + Msg::kTime + Msg::kCVSId);
00069 }
00070 cout << s;
00071
00072 cout << "AddFormat:\n";
00073 for (i=Msg::kMinLogLevel; i<Msg::kNLogLevel; ++i) {
00074 lvl = (Msg::LogLevel_t)i;
00075 s.AddFormat(lvl, Msg::kName + Msg::kFile + Msg::kLine);
00076 }
00077 cout << s;
00078
00079 cout << "RemoveFormat:\n";
00080 for (i=Msg::kMinLogLevel; i<Msg::kNLogLevel; ++i) {
00081 lvl = (Msg::LogLevel_t)i;
00082 s.RemoveFormat(lvl,
00083 Msg::kPriority + Msg::kName + Msg::kTime +
00084 Msg::kFile + Msg::kCVSId + Msg::kLine);
00085 }
00086 cout << s;
00087
00088 cout << "AttachOStream:\n";
00089 for (i=Msg::kMinLogLevel; i<Msg::kNLogLevel; ++i) {
00090 lvl = (Msg::LogLevel_t)i;
00091 s.AttachOStream(lvl, "cout");
00092 s.AttachOStream(lvl, "cerr");
00093 s.AttachOStream(lvl, "afile.txt");
00094 }
00095 cout << s;
00096
00097 cout << "DetachOStream:\n";
00098 for (i=Msg::kMinLogLevel; i<Msg::kNLogLevel; ++i) {
00099 lvl = (Msg::LogLevel_t)i;
00100 s.DetachOStream(lvl, "cout");
00101 s.AttachOStream(lvl, "cerr");
00102 s.DetachOStream(lvl, "afile.txt");
00103 }
00104 cout << s;
00105
00106 return passed;
00107 }
|
|
|
Definition at line 111 of file MsgStreamValidate.cxx. References __CVSID__, MsgStream::AttachOStream(), MsgStream::Close(), s(), and MsgStream::SetFormat(). Referenced by RunAllTests(). 00112 {
00113 bool passed = true;
00114 MsgStream s("Msg");
00115 string str = "String type works!";
00116
00117 s.AttachOStream(Msg::kInfo, "cout");
00118 s.AttachOStream(Msg::kInfo, "msgFile1.txt");
00119 s.AttachOStream(Msg::kInfo, "msgFile2.txt");
00120
00121 s.SetFormat(Msg::kInfo,
00122 Msg::kPriority +
00123 Msg::kName +
00124 Msg::kTime +
00125 Msg::kFile +
00126 Msg::kCVSId +
00127 Msg::kLine +
00128 Msg::kHost +
00129 Msg::kPID);
00130
00131 s(Msg::kInfo,
00132 __FILE__,
00133 __CVSID__,
00134 __LINE__)
00135 << "\n This message should get sent to: \n"
00136 << " cout, msgFile1.txt, msgFile2.txt\n"
00137 << " (" << 1 << " " << 1.2 << " " << 1.0e21 << ")\n";
00138
00139 s(Msg::kVerbose,
00140 __FILE__,
00141 __CVSID__,
00142 __LINE__)
00143 << "!!! Its an error if this message get printed!!!\n";
00144
00145 s(Msg::kInfo,
00146 __FILE__,
00147 __CVSID__,
00148 __LINE__)
00149 << "This checks the use of endl" << endl;
00150
00151 s(Msg::kInfo,
00152 __FILE__,
00153 __CVSID__,
00154 __LINE__)
00155 << "This checks the use of setw" << setw(9) << "1.23\n";
00156
00157 s(Msg::kInfo,
00158 __FILE__,
00159 __CVSID__,
00160 __LINE__)
00161 << "This checks the streamer for strings:" << str << endl;
00162
00163 s.Close();
00164
00165 return passed;
00166 }
|
1.3.9.1