summaryrefslogtreecommitdiffstats
path: root/host/test
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-28 01:18:27 -0800
committerJosh Blum <josh@joshknows.com>2010-03-28 01:18:27 -0800
commit7fc320448f30a6c7c327834f80764e5657c04995 (patch)
treef884d372ec7b4eedca4cdd77fa5bbc2dfd2e59f8 /host/test
parentb71d0cbea9e1e107eeb1da51ef14fe6b9e983ee6 (diff)
downloaduhd-7fc320448f30a6c7c327834f80764e5657c04995.tar.gz
uhd-7fc320448f30a6c7c327834f80764e5657c04995.tar.bz2
uhd-7fc320448f30a6c7c327834f80764e5657c04995.zip
minor fix to wax test to get unit testing working on windows, added missing config include to static.hpp to compile under windows
Diffstat (limited to 'host/test')
-rw-r--r--host/test/gain_handler_test.cpp4
-rw-r--r--host/test/wax_test.cpp19
2 files changed, 14 insertions, 9 deletions
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 <boost/test/unit_test.hpp>
+#include <boost/shared_ptr.hpp>
#include <uhd/wax.hpp>
#include <iostream>
@@ -32,26 +33,29 @@ BOOST_AUTO_TEST_CASE(test_enums){
* demo class for wax framework
**********************************************************************/
class wax_demo : public wax::obj{
-private:
- std::vector<float> d_nums;
- std::vector<wax_demo> d_subs;
public:
+ typedef boost::shared_ptr<wax_demo> sptr;
+
wax_demo(size_t sub_demos, size_t len){
d_nums = std::vector<float>(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<float> d_nums;
+ std::vector<sptr> d_subs;
+
void get(const wax::obj &key, wax::obj &value){
if (d_subs.size() == 0){
value = d_nums[key.as<size_t>()];
}else{
- value = d_subs[key.as<size_t>()].get_link();
+ value = d_subs[key.as<size_t>()]->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);