From 7fc320448f30a6c7c327834f80764e5657c04995 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 28 Mar 2010 01:18:27 -0800 Subject: minor fix to wax test to get unit testing working on windows, added missing config include to static.hpp to compile under windows --- host/include/uhd/utils/static.hpp | 2 ++ host/test/gain_handler_test.cpp | 4 ++-- host/test/wax_test.cpp | 19 ++++++++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'host') diff --git a/host/include/uhd/utils/static.hpp b/host/include/uhd/utils/static.hpp index 63db5a247..c61f10884 100644 --- a/host/include/uhd/utils/static.hpp +++ b/host/include/uhd/utils/static.hpp @@ -18,6 +18,8 @@ #ifndef INCLUDED_UHD_UTILS_STATIC_HPP #define INCLUDED_UHD_UTILS_STATIC_HPP +#include + /*! * Defines a function that implements the "construct on first use" idiom * \param _t the type definition for the instance diff --git a/host/test/gain_handler_test.cpp b/host/test/gain_handler_test.cpp index e13063e06..a7c6e1e82 100644 --- a/host/test/gain_handler_test.cpp +++ b/host/test/gain_handler_test.cpp @@ -46,8 +46,8 @@ public: ); _gain_values["g0"] = 0; _gain_values["g1"] = 0; - _gain_ranges["g0"] = gain_range_t(-10, 0, .1); - _gain_ranges["g1"] = gain_range_t(0, 100, 1.5); + _gain_ranges["g0"] = gain_range_t(-10, 0, float(.1)); + _gain_ranges["g1"] = gain_range_t(0, 100, float(1.5)); } ~gainful_obj(void){} diff --git a/host/test/wax_test.cpp b/host/test/wax_test.cpp index cb3b12052..731f470ed 100644 --- a/host/test/wax_test.cpp +++ b/host/test/wax_test.cpp @@ -16,6 +16,7 @@ // #include +#include #include #include @@ -32,26 +33,29 @@ BOOST_AUTO_TEST_CASE(test_enums){ * demo class for wax framework **********************************************************************/ class wax_demo : public wax::obj{ -private: - std::vector d_nums; - std::vector d_subs; public: + typedef boost::shared_ptr sptr; + wax_demo(size_t sub_demos, size_t len){ d_nums = std::vector(len); if (sub_demos != 0){ for (size_t i = 0; i < len; i++){ - d_subs.push_back(wax_demo(sub_demos-1, len)); + d_subs.push_back(sptr(new wax_demo(sub_demos-1, len))); } } } ~wax_demo(void){ /* NOP */ } +private: + std::vector d_nums; + std::vector d_subs; + void get(const wax::obj &key, wax::obj &value){ if (d_subs.size() == 0){ value = d_nums[key.as()]; }else{ - value = d_subs[key.as()].get_link(); + value = d_subs[key.as()]->get_link(); } } void set(const wax::obj &key, const wax::obj &value){ @@ -63,9 +67,8 @@ public: } }; -static wax_demo wd(2, 10); - BOOST_AUTO_TEST_CASE(test_chaining){ + wax_demo wd(2, 1); std::cout << "chain 1" << std::endl; wd[size_t(0)]; std::cout << "chain 2" << std::endl; @@ -75,6 +78,7 @@ BOOST_AUTO_TEST_CASE(test_chaining){ } BOOST_AUTO_TEST_CASE(test_set_get){ + wax_demo wd(2, 10); std::cout << "set and get all" << std::endl; for (size_t i = 0; i < 10; i++){ for (size_t j = 0; j < 10; j++){ @@ -89,6 +93,7 @@ BOOST_AUTO_TEST_CASE(test_set_get){ } BOOST_AUTO_TEST_CASE(test_proxy){ + wax_demo wd(2, 1); std::cout << "store proxy" << std::endl; wax::obj p = wd[size_t(0)][size_t(0)]; p[size_t(0)] = float(5); -- cgit v1.2.3