00001 00008 /***************************************************************************** 00009 ** Includes 00010 *****************************************************************************/ 00011 00012 #include <gtest/gtest.h> 00013 #include "../../include/ecl/time/cpuwatch.hpp" 00014 00015 /***************************************************************************** 00016 ** Platform Check 00017 *****************************************************************************/ 00018 00019 #include <ecl/config.hpp> 00020 00021 #if defined(ECL_IS_POSIX) 00022 // monotonic clock, cpu clock -> clock_gettime; clock_selection -> clock_nanosleep 00023 #if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK) >= 0L && defined(_POSIX_CLOCK_SELECTION) && (_POSIX_CLOCK_SELECTION) >= 0L 00024 00025 /***************************************************************************** 00026 ** Using 00027 *****************************************************************************/ 00028 00029 using ecl::CpuWatch; 00030 using ecl::TimeStamp; 00031 00032 /***************************************************************************** 00033 ** Tests 00034 *****************************************************************************/ 00035 00036 TEST(StopwatchTests,silent) { 00037 00038 CpuWatch stopwatch; 00039 TimeStamp time; 00040 00041 time = stopwatch.split(); 00042 time = stopwatch.split(); 00043 time = stopwatch.elapsed(); 00044 // Can't really verify stuff, so this is just a unit test to make sure 00045 // it compiles. 00046 SUCCEED(); 00047 } 00048 00049 #endif /* MANY POSIX TIME REQ'MENTS */ 00050 #endif /* ECL_IS_POSIX */ 00051 00052 /***************************************************************************** 00053 ** Main program 00054 *****************************************************************************/ 00055 00056 int main(int argc, char **argv) { 00057 00058 testing::InitGoogleTest(&argc,argv); 00059 return RUN_ALL_TESTS(); 00060 } 00061