aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorPaul David <paul.david@ettus.com>2017-05-09 21:36:02 -0400
committerMartin Braun <martin.braun@ettus.com>2017-05-23 17:14:32 -0700
commit2c0f1098351d6c0763d985c2085ec676a7992e2d (patch)
tree66b8c4cba5742f9e9a7f59d46c586957b35c4c28 /host/tests
parent056dabcaf37469d0e614d269ded3e6e4c41d4cc8 (diff)
downloaduhd-2c0f1098351d6c0763d985c2085ec676a7992e2d.tar.gz
uhd-2c0f1098351d6c0763d985c2085ec676a7992e2d.tar.bz2
uhd-2c0f1098351d6c0763d985c2085ec676a7992e2d.zip
Types: Added equality/inquality operators to support Boost.Python additions
- Added to subdev_spec_pair_t - Added to range_t - Added tests for the inequalities
Diffstat (limited to 'host/tests')
-rw-r--r--host/tests/ranges_test.cpp9
-rw-r--r--host/tests/subdev_spec_test.cpp8
2 files changed, 17 insertions, 0 deletions
diff --git a/host/tests/ranges_test.cpp b/host/tests/ranges_test.cpp
index 85bb4c3c4..49607b9a3 100644
--- a/host/tests/ranges_test.cpp
+++ b/host/tests/ranges_test.cpp
@@ -68,3 +68,12 @@ BOOST_AUTO_TEST_CASE(test_ranges_clip2){
BOOST_CHECK_CLOSE(mr.clip(3.1, true), 3., tolerance);
BOOST_CHECK_CLOSE(mr.clip(4., true), 3., tolerance);
}
+
+BOOST_AUTO_TEST_CASE(test_ranges_compare){
+ range_t range(1);
+ range_t n_range(1);
+ range_t d_range(2);
+
+ BOOST_CHECK(range == n_range);
+ BOOST_CHECK(range != d_range);
+}
diff --git a/host/tests/subdev_spec_test.cpp b/host/tests/subdev_spec_test.cpp
index 2c4747fa9..81f86380b 100644
--- a/host/tests/subdev_spec_test.cpp
+++ b/host/tests/subdev_spec_test.cpp
@@ -27,6 +27,11 @@ BOOST_AUTO_TEST_CASE(test_subdevice_spec){
sd_spec.push_back(uhd::usrp::subdev_spec_pair_t("A", "AB"));
sd_spec.push_back(uhd::usrp::subdev_spec_pair_t("B", "AB"));
+ //create a subdev_spec with something different
+ uhd::usrp::subdev_spec_t diff_sd_spec;
+ diff_sd_spec.push_back(uhd::usrp::subdev_spec_pair_t("B", "BA"));
+ diff_sd_spec.push_back(uhd::usrp::subdev_spec_pair_t("B", "BA"));
+
//convert to and from args string
std::cout << "Pretty Print: " << std::endl << sd_spec.to_pp_string();
std::string markup_str = sd_spec.to_string();
@@ -40,5 +45,8 @@ BOOST_AUTO_TEST_CASE(test_subdevice_spec){
for (size_t i = 0; i < sd_spec.size(); i++){
BOOST_CHECK_EQUAL(sd_spec.at(i).db_name, new_sd_spec.at(i).db_name);
BOOST_CHECK_EQUAL(sd_spec.at(i).sd_name, new_sd_spec.at(i).sd_name);
+
+ BOOST_CHECK(sd_spec.at(i) == new_sd_spec.at(i));
+ BOOST_CHECK(sd_spec.at(i) != diff_sd_spec.at(i));
}
}