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

unit test for ITimeKeeper simplest implementation More...

#include <cassert>
#include <cmath>
#include <iostream>
#include "TestTools/initGaudi.h"
#include "GaudiKernel/ISvcLocator.h"
#include "AthenaKernel/ITimeKeeper.h"
#include "BesServices/SimplePOSIXTimeKeeperSvc.h"

Go to the source code of this file.

Functions

int main ()


Detailed Description

unit test for ITimeKeeper simplest implementation

Based on ATLAS software

Definition in file SimplePOSIXTimeKeeperSvc_test.cxx.


Function Documentation

int main (  ) 

Definition at line 21 of file SimplePOSIXTimeKeeperSvc_test.cxx.

References genRecEmupikp::i.

00021            {
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 23:14:53 2016 for BOSS_7.0.2 by  doxygen 1.4.7