46 cout <<
"-I- ValValidate::RunAllTests had " << fail
47 <<
" failures in " << tests <<
" tests"
59 cout <<
"-I- Test ValTimeStamp" << endl << endl;
70 long int nsec = 12345;
72 struct timespec nowts;
73 nowts.tv_sec = nowtime;
77 cout <<
"-I- original timespec: {" << nowtime <<
"," << nsec <<
"} " << endl;
82 cout <<
" -I- vldnow as timespec: " << vldnow.
AsString(
"2") << endl;
83 cout <<
" vldnow default AsString: " << vldnow.
AsString(
"") << endl;
85 cout <<
" vldnow local AsString: " << vldnow.
AsString(
"l") << endl;
89 cout <<
" recovered timespec: {" << thents.tv_sec <<
"," << thents.tv_nsec <<
"} " << endl;
92 if (nowts.tv_sec != thents.tv_sec || nowts.tv_nsec != thents.tv_nsec) { fail++; }
97 time_t mytime = 978571563;
100 timespec mytimespec = {mytime,arbitrary};
112 ValTimeStamp vl1(year,month,day,hour,min,sec,arbitrary);
113 ValTimeStamp vl2(year,month,day,hour,min,sec,arbitrary,kFALSE,-secOffset);
114 ValTimeStamp vl3(year,month,day,hour-8,min,sec,arbitrary,kTRUE,8*60*60);
115 ValTimeStamp vl4(year,month,day-1,hour+16,min,sec,arbitrary,kTRUE,8*60*60);
117 ValTimeStamp vlpst(year,month,day,hour-8,min,sec,arbitrary,kFALSE);
119 ValTimeStamp vly1(year-1900,month,day,hour,min,sec,arbitrary);
120 ValTimeStamp vly2(year-2000,month,day,hour,min,sec,arbitrary);
122 Int_t date = year*10000 + month*100 + day;
123 Int_t
time = hour*10000 + min*100 + sec;
126 ValTimeStamp vs2(date,time,arbitrary,kFALSE,-secOffset);
128 ValTimeStamp vs3(date-1,time+160000,arbitrary,kTRUE,8*60*60);
129 ValTimeStamp vs4(date,time-80000,arbitrary,kTRUE,8*60*60);
132 ValTimeStamp vspst2(date-1,time+160000,arbitrary,kFALSE);
136 cout <<
" current TimeOffset is " << vtr.
GetZoneOffset() << endl;
138 cout <<
" std (vtr) " << vtr.
AsString() << endl;
140 TString byhand =
"Thu, 04 Jan 2001 01:26:03 +0000 (GMT) + 123456 nsec";
143 if (byhand != byclass) {
144 cout <<
" strings don't match!" << endl;
147 cout <<
" strings match as they should " << endl;
177 if (secOffset == 28800) {
186 cout <<
" next test expects to be a mismatch" << endl;
189 cout <<
" Alternative formats" << endl;
190 cout <<
" \"\" " << vtr.
AsString(
"") << endl;
191 cout <<
" \"l\" " << vtr.
AsString(
"l") << endl;
192 cout<<
" \"c\" " << vtr.
AsString(
"c") << endl;
193 cout <<
" \"lc\" " << vtr.
AsString(
"lc") << endl;
194 cout <<
" \"2\" " << vtr.
AsString(
"2") << endl;
197 if (vtr.
GetDate() != date) { fail++; }
202 cout <<
" GMT GetDate: " << vtr.
GetDate()
203 <<
" GetTime: " << vtr.
GetTime() << endl;
205 cout <<
" local GetDate: " << vtr.
GetDate(kFALSE)
206 <<
" GetTime: " << vtr.
GetTime(kFALSE) << endl;
208 cout <<
"ValValidate::TestTimeStamp had " << fail
209 <<
" failures in " << tests <<
" tests"
221 cout << label <<
" exact match " << endl;
224 cout << label <<
" ** mismatch ** " << endl;
225 cout <<
" " << test.
AsString() << endl;
226 cout<<
" " << std.
AsString() << endl;
236 cout <<
"Test ValContext" << endl << endl;
240 map<ValContext,long> vldc_map;
244 cout<<
"ValContext default ctor: "
246 vldc_map[defctor] = entry++;
250 vldc_map[defctor2] = entry++;
256 cout << endl <<
"ValContext test map<ValContext,long>" << endl;
258 for (Int_t ibit_det = 0; ibit_det<3; ibit_det++) {
261 for (Int_t ibit_sim = 0; ibit_sim<4; ibit_sim++) {
265 vldc_map[vldc] = entry++;
269 typedef map<ValContext,long>::const_iterator vcl_itr;
272 for (vcl_itr
p = vldc_map.begin();
p != vldc_map.end(); ++
p, ++expect) {
275 if (al != expect) { pass =
false; }
277 cout <<
" " << setw(2) << expect <<
" ? " << setw(2) << al <<
" : "
281 if (!pass) { fail++; }
285 cout <<
"ValValidate::TestContext had " << fail <<
" failures "
296 cout <<
"Test ValRange" << endl << endl;
304 cout <<
"ValValidate::TestRange had " << fail <<
" failures "
316 cout <<
"Test file IO" << endl << endl;
322 TFile fout(
"vld_io.root",
"RECREATE");
343 TFile fin(
"vld_io.root",
"READ");
357 cout <<
" wrote ValContext: " << out_c << endl;
358 cout <<
" interm ValContext: " << pause_c << endl;
359 cout <<
" read ValContext: " << (*in_c) << endl;
360 cout <<
" final ValContext: " << final_c << endl;
364 cout <<
"ValValidate::TestRange had " << fail <<
" failures "