/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Control/BesServices/BesServices-00-00-11/test/SimplePOSIXTimeKeeperSvc_test.cxx

Go to the documentation of this file.
00001 
00008 #include <cassert>
00009 #include <cmath>  /* sqrt */
00010 #include <iostream>
00011 #include "TestTools/initGaudi.h"
00012 #include "GaudiKernel/ISvcLocator.h"
00013 #include "AthenaKernel/ITimeKeeper.h"
00014 #include "BesServices/SimplePOSIXTimeKeeperSvc.h"
00015 
00016 using std::cerr;
00017 using std::cout;
00018 using std::endl;
00019 using namespace Athena_test;
00020 
00021 int main() {
00022   cout << "*** SimplePOSIXTimeKeeperSvc_test starts ***" <<endl;
00023   ISvcLocator* pSvcLoc(0);
00024   if (!initGaudi("SimplePOSIXTimeKeeperSvc_test.txt", pSvcLoc)) {
00025     cerr << "This test can not be run" << endl;
00026     return 0;
00027   }  
00028   assert(pSvcLoc);
00029 
00030   //locate time keeper
00031   const bool CREATEIF(true);
00032   ITimeKeeper* pITK(0);
00033   assert( (pSvcLoc->service("SimplePOSIXTimeKeeperSvc", pITK, CREATEIF)).isSuccess() );
00034   assert( pITK );
00035   //  cout <<  *pITK <<endl;
00036 
00037   SimplePOSIXTimeKeeperSvc& tk(dynamic_cast<SimplePOSIXTimeKeeperSvc&>(*pITK));
00038   assert(tk.timeX() + tk.timeL() == tk.allocTime());
00039 
00040   while (pITK->nextIter()) {
00041     for (int i=0; i<20000000; ++i) atan(i); //waste some time
00042   }
00043 
00044   assert(tk.timeX() + tk.timeL() == tk.allocTime());
00045 
00046   tk.finalize();
00047 
00048   //all done
00049   cout << "*** SimplePOSIXTimeKeeperSvc_test OK ***" <<endl;
00050   return 0;
00051 }

Generated on Tue Nov 29 22:57:58 2016 for BOSS_7.0.2 by  doxygen 1.4.7