summaryrefslogtreecommitdiffstats
path: root/host/test
diff options
context:
space:
mode:
Diffstat (limited to 'host/test')
-rw-r--r--host/test/gain_group_test.cpp20
-rw-r--r--host/test/ranges_test.cpp12
2 files changed, 16 insertions, 16 deletions
diff --git a/host/test/gain_group_test.cpp b/host/test/gain_group_test.cpp
index dbb585987..79487b2ba 100644
--- a/host/test/gain_group_test.cpp
+++ b/host/test/gain_group_test.cpp
@@ -52,7 +52,7 @@ class gain_element2{
public:
gain_range_t get_range(void){
- return gain_range_t(-20, 10, float(0.1));
+ return gain_range_t(-20, 10, 0.1);
}
float get_value(void){
@@ -94,17 +94,17 @@ static gain_group::sptr get_gain_group(size_t pri1 = 0, size_t pri2 = 0){
/***********************************************************************
* Test cases
**********************************************************************/
-static const float tolerance = float(0.001);
+static const double tolerance = 0.001;
BOOST_AUTO_TEST_CASE(test_gain_group_overall){
gain_group::sptr gg = get_gain_group();
//test the overall stuff
gg->set_value(80);
- BOOST_CHECK_CLOSE(gg->get_value(), float(80), tolerance);
- BOOST_CHECK_CLOSE(gg->get_range().start(), float(-20), tolerance);
- BOOST_CHECK_CLOSE(gg->get_range().stop(), float(100), tolerance);
- BOOST_CHECK_CLOSE(gg->get_range().step(), float(0.1), tolerance);
+ BOOST_CHECK_CLOSE(gg->get_value(), 80, tolerance);
+ BOOST_CHECK_CLOSE(gg->get_range().start(), -20, tolerance);
+ BOOST_CHECK_CLOSE(gg->get_range().stop(), 100, tolerance);
+ BOOST_CHECK_CLOSE(gg->get_range().step(), 0.1, tolerance);
}
BOOST_AUTO_TEST_CASE(test_gain_group_priority){
@@ -112,10 +112,10 @@ BOOST_AUTO_TEST_CASE(test_gain_group_priority){
//test the overall stuff
gg->set_value(80);
- BOOST_CHECK_CLOSE(gg->get_value(), float(80), tolerance);
- BOOST_CHECK_CLOSE(gg->get_range().start(), float(-20), tolerance);
- BOOST_CHECK_CLOSE(gg->get_range().stop(), float(100), tolerance);
- BOOST_CHECK_CLOSE(gg->get_range().step(), float(0.1), tolerance);
+ BOOST_CHECK_CLOSE(gg->get_value(), 80, tolerance);
+ BOOST_CHECK_CLOSE(gg->get_range().start(), -20, tolerance);
+ BOOST_CHECK_CLOSE(gg->get_range().stop(), 100, tolerance);
+ BOOST_CHECK_CLOSE(gg->get_range().step(), 0.1, tolerance);
//test the the higher priority gain got filled first (gain 2)
BOOST_CHECK_CLOSE(g2.get_value(), g2.get_range().stop(), tolerance);
diff --git a/host/test/ranges_test.cpp b/host/test/ranges_test.cpp
index ad61867e1..bbc7f4661 100644
--- a/host/test/ranges_test.cpp
+++ b/host/test/ranges_test.cpp
@@ -24,13 +24,13 @@ using namespace uhd;
static const double tolerance = 0.001;
BOOST_AUTO_TEST_CASE(test_ranges_bounds){
- meta_range_t<double> mr;
- mr.push_back(range_t<double>(-1.0, +1.0, 0.1));
+ meta_range_t mr;
+ mr.push_back(range_t(-1.0, +1.0, 0.1));
BOOST_CHECK_CLOSE(mr.start(), -1.0, tolerance);
BOOST_CHECK_CLOSE(mr.stop(), +1.0, tolerance);
BOOST_CHECK_CLOSE(mr.step(), 0.1, tolerance);
- mr.push_back(range_t<double>(40.0, 60.0, 1.0));
+ mr.push_back(range_t(40.0, 60.0, 1.0));
BOOST_CHECK_CLOSE(mr.start(), -1.0, tolerance);
BOOST_CHECK_CLOSE(mr.stop(), 60.0, tolerance);
BOOST_CHECK_CLOSE(mr.step(), 0.1, tolerance);
@@ -43,9 +43,9 @@ BOOST_AUTO_TEST_CASE(test_ranges_bounds){
}
BOOST_AUTO_TEST_CASE(test_ranges_clip){
- meta_range_t<double> mr;
- mr.push_back(range_t<double>(-1.0, +1.0, 0.1));
- mr.push_back(range_t<double>(40.0, 60.0, 1.0));
+ meta_range_t mr;
+ mr.push_back(range_t(-1.0, +1.0, 0.1));
+ mr.push_back(range_t(40.0, 60.0, 1.0));
BOOST_CHECK_CLOSE(mr.clip(-30.0), -1.0, tolerance);
BOOST_CHECK_CLOSE(mr.clip(70.0), 60.0, tolerance);