aboutsummaryrefslogtreecommitdiffstats
path: root/host/test
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-11 18:37:34 -0800
committerJosh Blum <josh@joshknows.com>2010-03-11 18:37:34 -0800
commitdaed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5 (patch)
tree72286b6649af0bf99e84edca08b584cb2e6af6ae /host/test
parent9c0fb5e15da3c8ccbc1c8537671703411b210fcf (diff)
downloaduhd-daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5.tar.gz
uhd-daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5.tar.bz2
uhd-daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5.zip
Cleaned up the gain handler (thing that gets and sets wildcard gains)
and made use of it in the dboard manager so it intercepts the sets and gets. While doing this, fixed something with nested links in wax obj. Added some useful macros and templates to the utils.
Diffstat (limited to 'host/test')
-rw-r--r--host/test/gain_handler_test.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/host/test/gain_handler_test.cpp b/host/test/gain_handler_test.cpp
index c81221aac..9a6a50dab 100644
--- a/host/test/gain_handler_test.cpp
+++ b/host/test/gain_handler_test.cpp
@@ -17,7 +17,9 @@
#include <boost/test/unit_test.hpp>
#include <uhd/gain_handler.hpp>
+#include <uhd/props.hpp>
#include <uhd/dict.hpp>
+#include <boost/bind.hpp>
#include <iostream>
using namespace uhd;
@@ -33,9 +35,17 @@ enum prop_t{
class gainful_obj : public wax::obj{
public:
gainful_obj(void){
- _gain_handler = gain_handler::sptr(new gain_handler(
- this, PROP_GAIN, PROP_GAIN_MIN, PROP_GAIN_MAX, PROP_GAIN_STEP, PROP_GAIN_NAMES
- ));
+ //initialize gain props struct
+ gain_handler::gain_props_t gain_props;
+ gain_props.gain_val_prop = PROP_GAIN;
+ gain_props.gain_min_prop = PROP_GAIN_MIN;
+ gain_props.gain_max_prop = PROP_GAIN_MAX;
+ gain_props.gain_step_prop = PROP_GAIN_STEP;
+ gain_props.gain_names_prop = PROP_GAIN_NAMES;
+ //make a new gain handler
+ _gain_handler = gain_handler::make(
+ this->get_link(), gain_props, boost::bind(&gain_handler::is_equal<prop_t>, _1, _2)
+ );
_gains["g0"] = 0;
_gains["g1"] = 0;
_gains_min["g0"] = -10;
@@ -113,7 +123,7 @@ BOOST_AUTO_TEST_CASE(test_gain_handler){
BOOST_CHECK_THROW(
wax::cast<gain_t>(go0[named_prop_t(PROP_GAIN, "fail")]),
- std::invalid_argument
+ std::exception
);
std::cout << "verifying the overall min, max, step" << std::endl;