PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
main.cpp File Reference
#include <iostream>
#include "phoenix_assert.h"
#include "PTimer.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void testPTimer ()
 Test the PTimer. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 39 of file main.cpp.

39  {
40  testPTimer();
41  return 0;
42 }

References testPTimer().

+ Here is the call graph for this function:

◆ testPTimer()

void testPTimer ( )

Test the PTimer.

Definition at line 13 of file main.cpp.

13  {
14  PTimer timer1(1000000000lu);
15  PTimer timer2;
16  timer2.setEllapsedTime(100000000lu);
17 
18  size_t counter(0lu), counterTimer2(0lu);
19  while(!timer1.isTime()){
20  size_t ellapsedTimeNs(0lu);
21  if(timer2.isTime(ellapsedTimeNs)){
22  std::cerr << counterTimer2 << " : " << ellapsedTimeNs << std::endl;
23  ++counterTimer2;
24  }
25  ++counter;
26  }
27 // std::cout << "counter\t= " << counter << std::endl;
28 // std::cout << "counterTimer2\t= " << counterTimer2 << std::endl;
29 
30  phoenix_assert(timer1.getEllapsedTime() == 1000000000lu);
31  phoenix_assert(timer2.getEllapsedTime() == 100000000lu);
32  PTimer timer3(timer2), timer4;
33  timer4 = timer1;
34 
35  phoenix_assert(timer4.getEllapsedTime() == 1000000000lu);
36  phoenix_assert(timer3.getEllapsedTime() == 100000000lu);
37 }

References PTimer::getEllapsedTime(), PTimer::isTime(), phoenix_assert, and PTimer::setEllapsedTime().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
PTimer
Timer which allows to call function every time a defined ellapsed time is out.
Definition: PTimer.h:13
testPTimer
void testPTimer()
Test the PTimer.
Definition: main.cpp:13
PTimer::isTime
bool isTime()
Returns true if the given ellapsed time between to call is passed.
Definition: PTimer.cpp:61
phoenix_assert
#define phoenix_assert(isOk)
Definition: phoenix_assert.h:19
PTimer::setEllapsedTime
void setEllapsedTime(size_t ellapsedTime)
Set the ellapsed time in nanoseconds.
Definition: PTimer.cpp:47
PTimer::getEllapsedTime
size_t getEllapsedTime() const
Get the ellapsed time in nanoseconds.
Definition: PTimer.cpp:54