diff options
Diffstat (limited to 'host/test/wax_test.cpp')
-rw-r--r-- | host/test/wax_test.cpp | 15 |
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)); } |