aboutsummaryrefslogtreecommitdiffstats
path: root/host/test
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-10-27 08:07:45 -0700
committerJosh Blum <josh@joshknows.com>2010-10-27 08:07:45 -0700
commit4fb937339bbe95091b5a22276d9618dc8e178f68 (patch)
tree61a604de6ab352bfe3d90fdc77e0d92ea8501bfc /host/test
parentdb0e3e574e9058ad51cacea91ccc42f0baed95fa (diff)
parenta7840ebb3f7d7f807d05059e2809eb45cff04899 (diff)
downloaduhd-4fb937339bbe95091b5a22276d9618dc8e178f68.tar.gz
uhd-4fb937339bbe95091b5a22276d9618dc8e178f68.tar.bz2
uhd-4fb937339bbe95091b5a22276d9618dc8e178f68.zip
Merge branch 'next' into usrp_e
Diffstat (limited to 'host/test')
-rw-r--r--host/test/gain_group_test.cpp4
-rw-r--r--host/test/tune_helper_test.cpp79
-rw-r--r--host/test/warning_test.cpp4
3 files changed, 80 insertions, 7 deletions
diff --git a/host/test/gain_group_test.cpp b/host/test/gain_group_test.cpp
index 761372e5a..555ccaed3 100644
--- a/host/test/gain_group_test.cpp
+++ b/host/test/gain_group_test.cpp
@@ -81,12 +81,12 @@ static gain_group::sptr get_gain_group(size_t pri1 = 0, size_t pri2 = 0){
gain_fcns.get_range = boost::bind(&gain_element1::get_range, &g1);
gain_fcns.get_value = boost::bind(&gain_element1::get_value, &g1);
gain_fcns.set_value = boost::bind(&gain_element1::set_value, &g1, _1);
- gg->register_fcns(gain_fcns, pri1);
+ gg->register_fcns("g1", gain_fcns, pri1);
gain_fcns.get_range = boost::bind(&gain_element2::get_range, &g2);
gain_fcns.get_value = boost::bind(&gain_element2::get_value, &g2);
gain_fcns.set_value = boost::bind(&gain_element2::set_value, &g2, _1);
- gg->register_fcns(gain_fcns, pri2);
+ gg->register_fcns("g2", gain_fcns, pri2);
return gg;
}
diff --git a/host/test/tune_helper_test.cpp b/host/test/tune_helper_test.cpp
index 1ef4af330..e0500ae3f 100644
--- a/host/test/tune_helper_test.cpp
+++ b/host/test/tune_helper_test.cpp
@@ -91,6 +91,44 @@ private:
}
};
+class dummy_subdev_bw : public wax::obj{
+private:
+ void get(const wax::obj &key, wax::obj &val){
+ switch(key.as<subdev_prop_t>()){
+
+ case SUBDEV_PROP_FREQ:
+ val = _freq;
+ return;
+
+ case SUBDEV_PROP_USE_LO_OFFSET:
+ val = true;
+ return;
+
+ case SUBDEV_PROP_BANDWIDTH:
+ val = _bandwidth;
+ return;
+
+ default: UHD_THROW_PROP_GET_ERROR();
+ }
+ }
+
+ void set(const wax::obj &key, const wax::obj &val){
+ switch(key.as<subdev_prop_t>()){
+ case SUBDEV_PROP_FREQ:
+ _freq = val.as<double>();
+ return;
+
+ case SUBDEV_PROP_BANDWIDTH:
+ _bandwidth = val.as<double>();
+ return;
+
+ default: UHD_THROW_PROP_SET_ERROR();
+ }
+ }
+
+ double _freq, _bandwidth;
+};
+
class dummy_dsp : public wax::obj{
public:
dummy_dsp(double codec_rate):
@@ -106,6 +144,10 @@ private:
val = _codec_rate;
return;
+ case DSP_PROP_HOST_RATE:
+ val = _host_rate;
+ return;
+
case DSP_PROP_FREQ_SHIFT:
val = _freq_shift;
return;
@@ -125,11 +167,15 @@ private:
_freq_shift = val.as<double>();
return;
+ case DSP_PROP_HOST_RATE:
+ _host_rate = val.as<double>();
+ return;
+
default: UHD_THROW_PROP_SET_ERROR();
}
}
- double _codec_rate, _freq_shift;
+ double _codec_rate, _freq_shift, _host_rate;
};
/***********************************************************************
@@ -141,7 +187,7 @@ BOOST_AUTO_TEST_CASE(test_tune_helper_rx){
dummy_subdev subdev(1e6);
dummy_dsp dsp(100e6);
- std::cout << "Testing tune helper RX automatic LO offset" << std::endl;
+ std::cout << "Testing tune helper RX automatic IF offset" << std::endl;
tune_result_t tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 0, 2.3451e9);
std::cout << tr.to_pp_string() << std::endl;
BOOST_CHECK_CLOSE(tr.actual_inter_freq, 2.345e9, tolerance);
@@ -155,7 +201,7 @@ BOOST_AUTO_TEST_CASE(test_tune_helper_tx){
dummy_subdev subdev(1e6);
dummy_dsp dsp(100e6);
- std::cout << "Testing tune helper TX automatic LO offset" << std::endl;
+ std::cout << "Testing tune helper TX automatic IF offset" << std::endl;
tune_result_t tr = tune_tx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 0, 2.3451e9);
std::cout << tr.to_pp_string() << std::endl;
BOOST_CHECK_CLOSE(tr.actual_inter_freq, 2.345e9, tolerance);
@@ -178,3 +224,30 @@ BOOST_AUTO_TEST_CASE(test_tune_helper_rx_nyquist){
double freq_derived = derive_freq_from_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 0);
BOOST_CHECK_CLOSE(freq_derived, -45e6, tolerance);
}
+
+BOOST_AUTO_TEST_CASE(test_tune_helper_rx_lo_off){
+ dummy_subdev_bw subdev;
+ dummy_dsp dsp(100e6);
+ tune_result_t tr;
+
+ std::cout << "Testing tune helper RX automatic LO offset B >> fs" << std::endl;
+ subdev[SUBDEV_PROP_BANDWIDTH] = double(40e6);
+ dsp[DSP_PROP_HOST_RATE] = double(4e6);
+ tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 0, 2.45e9);
+ std::cout << tr.to_pp_string() << std::endl;
+ BOOST_CHECK_CLOSE(tr.actual_inter_freq, 2.45e9+4e6/2, tolerance);
+
+ std::cout << "Testing tune helper RX automatic LO offset B > fs" << std::endl;
+ subdev[SUBDEV_PROP_BANDWIDTH] = double(40e6);
+ dsp[DSP_PROP_HOST_RATE] = double(25e6);
+ tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 0, 2.45e9);
+ std::cout << tr.to_pp_string() << std::endl;
+ BOOST_CHECK_CLOSE(tr.actual_inter_freq, 2.45e9+(40e6-25e6)/2, tolerance);
+
+ std::cout << "Testing tune helper RX automatic LO offset B < fs" << std::endl;
+ subdev[SUBDEV_PROP_BANDWIDTH] = double(20e6);
+ dsp[DSP_PROP_HOST_RATE] = double(25e6);
+ tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 0, 2.45e9);
+ std::cout << tr.to_pp_string() << std::endl;
+ BOOST_CHECK_CLOSE(tr.actual_inter_freq, 2.45e9, tolerance);
+}
diff --git a/host/test/warning_test.cpp b/host/test/warning_test.cpp
index 6202c4270..db19955de 100644
--- a/host/test/warning_test.cpp
+++ b/host/test/warning_test.cpp
@@ -19,9 +19,9 @@
#include <uhd/utils/warning.hpp>
#include <iostream>
-BOOST_AUTO_TEST_CASE(test_print_warning){
+BOOST_AUTO_TEST_CASE(test_warning_post){
std::cerr << "---begin print test ---" << std::endl;
- uhd::print_warning(
+ uhd::warning::post(
"This is a test print for a warning message.\n"
"And this is the second line of the test print.\n"
);