MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / TestTaskTimer

Function TestTaskTimer

src/twtest/tasktimer_t.cpp:38–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36#include <unistd.h>
37
38void TestTaskTimer()
39{
40 cTaskTimer timer("unit testing");
41
42 TEST(!timer.IsRunning());
43 TEST(0 == timer.GetTotalTime());
44 TEST(0 == timer.GetNumTimesStarted());
45
46 for (int counter = 0; counter < 5; counter++)
47 {
48 timer.Start();
49 TEST(timer.IsRunning());
50 sleep(1);
51 timer.Stop();
52 TEST(!timer.IsRunning());
53 }
54
55 TEST(!timer.IsRunning());
56 TEST(5 <= timer.GetTotalTime());
57 TEST(5 == timer.GetNumTimesStarted());
58}
59
60void RegisterSuite_TaskTimer()
61{

Callers

nothing calls this directly

Calls 5

IsRunningMethod · 0.80
GetTotalTimeMethod · 0.80
GetNumTimesStartedMethod · 0.80
StopMethod · 0.80
StartMethod · 0.45

Tested by

no test coverage detected