BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
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

◆ main()

int main ( )

Definition at line 21 of file SimplePOSIXTimeKeeperSvc_test.cxx.

21 {
22 cout << "*** SimplePOSIXTimeKeeperSvc_test starts ***" <<endl;
23 ISvcLocator* pSvcLoc(0);
24 if (!initGaudi("SimplePOSIXTimeKeeperSvc_test.txt", pSvcLoc)) {
25 cerr << "This test can not be run" << endl;
26 return 0;
27 }
28 assert(pSvcLoc);
29
30 //locate time keeper
31 const bool CREATEIF(true);
32 ITimeKeeper* pITK(0);
33 assert( (pSvcLoc->service("SimplePOSIXTimeKeeperSvc", pITK, CREATEIF)).isSuccess() );
34 assert( pITK );
35 // cout << *pITK <<endl;
36
37 SimplePOSIXTimeKeeperSvc& tk(dynamic_cast<SimplePOSIXTimeKeeperSvc&>(*pITK));
38 assert(tk.timeX() + tk.timeL() == tk.allocTime());
39
40 while (pITK->nextIter()) {
41 for (int i=0; i<20000000; ++i) atan(i); //waste some time
42 }
43
44 assert(tk.timeX() + tk.timeL() == tk.allocTime());
45
46 tk.finalize();
47
48 //all done
49 cout << "*** SimplePOSIXTimeKeeperSvc_test OK ***" <<endl;
50 return 0;
51}