summaryrefslogtreecommitdiffstats
path: root/host/test/wax_test.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-15 17:43:10 -0700
committerJosh Blum <josh@joshknows.com>2010-03-15 17:43:10 -0700
commitfc40ff2f1327d01c72c4d7dbc07a14e473251981 (patch)
treead7f1ed847d284c3982157e1c43a13773a6aca9c /host/test/wax_test.cpp
parente4997af8453980922b469e5d3b66a7b26910dad3 (diff)
downloaduhd-fc40ff2f1327d01c72c4d7dbc07a14e473251981.tar.gz
uhd-fc40ff2f1327d01c72c4d7dbc07a14e473251981.tar.bz2
uhd-fc40ff2f1327d01c72c4d7dbc07a14e473251981.zip
Replaced uses of wax:cast with the templated as method (like in boost program options).
Diffstat (limited to 'host/test/wax_test.cpp')
-rw-r--r--host/test/wax_test.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/host/test/wax_test.cpp b/host/test/wax_test.cpp
index e5e1adc25..b793b2690 100644
--- a/host/test/wax_test.cpp
+++ b/host/test/wax_test.cpp
@@ -17,14 +17,15 @@
#include <boost/test/unit_test.hpp>
#include <uhd/wax.hpp>
+#include <iostream>
enum opt_a_t{OPTION_A_0, OPTION_A_1};
enum opt_b_t{OPTION_B_0, OPTION_B_1};
BOOST_AUTO_TEST_CASE(test_enums){
wax::obj opta = OPTION_A_0;
- BOOST_CHECK_THROW(wax::cast<opt_b_t>(opta), wax::bad_cast);
- BOOST_CHECK_EQUAL(wax::cast<opt_a_t>(opta), OPTION_A_0);
+ BOOST_CHECK_THROW(opta.as<opt_b_t>(), wax::bad_cast);
+ BOOST_CHECK_EQUAL(opta.as<opt_a_t>(), OPTION_A_0);
}
/***********************************************************************
@@ -48,14 +49,14 @@ public:
}
void get(const wax::obj &key, wax::obj &value){
if (d_subs.size() == 0){
- value = d_nums[wax::cast<size_t>(key)];
+ value = d_nums[key.as<size_t>()];
}else{
- value = d_subs[wax::cast<size_t>(key)].get_link();
+ value = d_subs[key.as<size_t>()].get_link();
}
}
void set(const wax::obj &key, const wax::obj &value){
if (d_subs.size() == 0){
- d_nums[wax::cast<size_t>(key)] = wax::cast<float>(value);
+ d_nums[key.as<size_t>()] = value.as<float>();
}else{
throw std::runtime_error("cant set to a wax demo with sub demos");
}
@@ -81,7 +82,7 @@ BOOST_AUTO_TEST_CASE(test_set_get){
float val = i * j * k + i + j + k;
//std::cout << i << " " << j << " " << k << std::endl;
wd[i][j][k] = val;
- BOOST_CHECK_EQUAL(val, wax::cast<float>(wd[i][j][k]));
+ BOOST_CHECK_EQUAL(val, wd[i][j][k].as<float>());
}
}
}
@@ -94,5 +95,5 @@ BOOST_AUTO_TEST_CASE(test_proxy){
std::cout << "assign proxy" << std::endl;
wax::obj a = p[size_t(0)];
- BOOST_CHECK_EQUAL(wax::cast<float>(a), float(5));
+ BOOST_CHECK_EQUAL(a.as<float>(), float(5));
}