summaryrefslogtreecommitdiffstats
path: root/host/test/wax_test.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-30 13:32:52 +0000
committerJosh Blum <josh@joshknows.com>2010-03-30 13:32:52 +0000
commitf94fa1e464c9e2a87274c991dc6461f7f4c956d8 (patch)
tree1b88020a0dece1ae509cf3fb219b7cce487dc198 /host/test/wax_test.cpp
parent29e88b3478aad89ff76363029395200a8601e667 (diff)
parent281307833c8275031bd2469e6aef3f472490749a (diff)
downloaduhd-f94fa1e464c9e2a87274c991dc6461f7f4c956d8.tar.gz
uhd-f94fa1e464c9e2a87274c991dc6461f7f4c956d8.tar.bz2
uhd-f94fa1e464c9e2a87274c991dc6461f7f4c956d8.zip
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhd into usrp_e
Conflicts: host/include/uhd/usrp/dboard_id.hpp host/lib/usrp/usrp2/usrp2_impl.cpp
Diffstat (limited to 'host/test/wax_test.cpp')
-rw-r--r--host/test/wax_test.cpp19
1 files changed, 12 insertions, 7 deletions
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);