sleep.cpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Includes
00010 *****************************************************************************/
00011 
00012 //#include <iostream>
00013 #include <gtest/gtest.h>
00014 #include "../../include/ecl/time/sleep.hpp"
00015 #include "../../include/ecl/time/timestamp.hpp"
00016 
00017 /*****************************************************************************
00018 ** Platform Check
00019 *****************************************************************************/
00020 
00021 // Only posix implementation so far
00022 #include <ecl/config.hpp>
00023 #if defined(ECL_IS_POSIX)
00024 
00025 /*****************************************************************************
00026 ** Using
00027 *****************************************************************************/
00028 
00029 using ecl::Duration;
00030 using ecl::Sleep;
00031 using ecl::MilliSleep;
00032 using ecl::MicroSleep;
00033 using ecl::NanoSleep;
00034 
00035 /*****************************************************************************
00036 ** Tests
00037 *****************************************************************************/
00038 
00039 TEST(SleepTests,sleepConfigured) {
00040 
00041         Duration duration(1,300000000);
00042     Sleep sleep;
00043     MilliSleep sleep_ms;
00044     MicroSleep sleep_us;
00045     NanoSleep sleep_ns;
00046 
00047     sleep(duration);
00048     sleep(1);
00049     sleep_ms(500);
00050     sleep_us(500000);
00051     sleep_ns(500000000);
00052 
00053     SUCCEED();
00054 }
00055 
00056 TEST(SleepTests,sleepPreConfigured) {
00057         Duration duration(1,300000000);
00058     Sleep sleep_1_3s(duration);
00059     sleep_1_3s();
00060     MilliSleep sleep_1400ms(1400);
00061     sleep_1400ms();
00062     MicroSleep sleep_1400us(1400);
00063     sleep_1400us();
00064     NanoSleep sleep_1400ns(1400);
00065     sleep_1400ns();
00066     SUCCEED();
00067 }
00068 
00069 #endif /* ECL_IS_POSIX */
00070 
00071 /*****************************************************************************
00072 ** Main program
00073 *****************************************************************************/
00074 
00075 int main(int argc, char **argv) {
00076 
00077     testing::InitGoogleTest(&argc,argv);
00078     return RUN_ALL_TESTS();
00079 }
00080 
00081 


ecl_time
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:17:28