diff options
Diffstat (limited to 'host/tests')
-rw-r--r-- | host/tests/CMakeLists.txt | 13 | ||||
-rw-r--r-- | host/tests/time_spec_test.cpp | 11 |
2 files changed, 21 insertions, 3 deletions
diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt index 67e99941b..f5cead184 100644 --- a/host/tests/CMakeLists.txt +++ b/host/tests/CMakeLists.txt @@ -16,6 +16,11 @@ # ######################################################################## +# unit test support +######################################################################## +include(UHDUnitTest) + +######################################################################## # unit test suite ######################################################################## SET(test_sources @@ -39,13 +44,15 @@ SET(test_sources #turn each test cpp file into an executable with an int main() function ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) -#for each source: build an executable, register it as a test, and install +SET(UHD_TEST_TARGET_DEPS uhd) +SET(UHD_TEST_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}) + +#for each source: build an executable, register it as a test FOREACH(test_source ${test_sources}) GET_FILENAME_COMPONENT(test_name ${test_source} NAME_WE) ADD_EXECUTABLE(${test_name} ${test_source}) TARGET_LINK_LIBRARIES(${test_name} uhd) - ADD_TEST(${test_name} ${test_name}) - INSTALL(TARGETS ${test_name} RUNTIME DESTINATION ${PKG_LIB_DIR}/tests COMPONENT tests) + UHD_ADD_TEST(${test_name} ${test_name}) ENDFOREACH(test_source) ######################################################################## diff --git a/host/tests/time_spec_test.cpp b/host/tests/time_spec_test.cpp index 102b7cda3..139a113af 100644 --- a/host/tests/time_spec_test.cpp +++ b/host/tests/time_spec_test.cpp @@ -97,3 +97,14 @@ BOOST_AUTO_TEST_CASE(test_time_spec_neg_values){ BOOST_CHECK(tsa > tsb); BOOST_CHECK(tsc > tsd); } + +BOOST_AUTO_TEST_CASE(test_time_large_ticks_to_time_spec) +{ + std::cout << "sizeof(time_t) " << sizeof(time_t) << std::endl; + const boost::uint64_t ticks0 = boost::uint64_t(100e6*1360217663.739296); + const uhd::time_spec_t t0 = uhd::time_spec_t::from_ticks(ticks0, 100e6); + std::cout << "t0.get_real_secs() " << t0.get_real_secs() << std::endl; + std::cout << "t0.get_full_secs() " << t0.get_full_secs() << std::endl; + std::cout << "t0.get_frac_secs() " << t0.get_frac_secs() << std::endl; + BOOST_CHECK_EQUAL(t0.get_full_secs(), time_t(1360217663)); +} |