test/sleep.cpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Includes
10 *****************************************************************************/
11 
12 //#include <iostream>
13 #include <gtest/gtest.h>
14 #include "../../include/ecl/time/sleep.hpp"
15 #include "../../include/ecl/time/timestamp.hpp"
16 
17 /*****************************************************************************
18 ** Platform Check
19 *****************************************************************************/
20 
21 // Only posix implementation so far
22 #include <ecl/config.hpp>
23 #if defined(ECL_IS_POSIX)
24 
25 /*****************************************************************************
26 ** Using
27 *****************************************************************************/
28 
29 using ecl::Duration;
30 using ecl::Sleep;
31 using ecl::MilliSleep;
32 using ecl::MicroSleep;
33 using ecl::NanoSleep;
34 
35 /*****************************************************************************
36 ** Tests
37 *****************************************************************************/
38 
39 TEST(SleepTests,sleepConfigured) {
40 
41  Duration duration(1,300000000);
42  Sleep sleep;
43  MilliSleep sleep_ms;
44  MicroSleep sleep_us;
45  NanoSleep sleep_ns;
46 
47  sleep(duration);
48  sleep(1);
49  sleep_ms(500);
50  sleep_us(500000);
51  sleep_ns(500000000);
52 
53  SUCCEED();
54 }
55 
56 TEST(SleepTests,sleepPreConfigured) {
57  Duration duration(1,300000000);
58  Sleep sleep_1_3s(duration);
59  sleep_1_3s();
60  MilliSleep sleep_1400ms(1400);
61  sleep_1400ms();
62  MicroSleep sleep_1400us(1400);
63  sleep_1400us();
64  NanoSleep sleep_1400ns(1400);
65  sleep_1400ns();
66  SUCCEED();
67 }
68 
69 #endif /* ECL_IS_POSIX */
70 
71 /*****************************************************************************
72 ** Main program
73 *****************************************************************************/
74 
75 int main(int argc, char **argv) {
76 
77  testing::InitGoogleTest(&argc,argv);
78  return RUN_ALL_TESTS();
79 }
80 
81 
int main(int argc, char **argv)
Definition: test/sleep.cpp:75
TEST(TimeDataTests, container)
TimeStamp Duration
Convenience typedef to associate timestamps with the concept of durations.
Definition: duration.hpp:41


ecl_time
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:15