summaryrefslogtreecommitdiffstats
path: root/host/tests/ranges_test.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-03 20:34:06 -0700
committerJosh Blum <josh@joshknows.com>2011-11-03 20:37:14 -0700
commit07fb8d2b82c59ddaf7722b12db8c1387011fb34b (patch)
treeb6c37b7ef0db85293e418ffd3d1b3376a520da14 /host/tests/ranges_test.cpp
parent5cdbf5b36969e12b93e720f67102dd4ab246b074 (diff)
downloaduhd-07fb8d2b82c59ddaf7722b12db8c1387011fb34b.tar.gz
uhd-07fb8d2b82c59ddaf7722b12db8c1387011fb34b.tar.bz2
uhd-07fb8d2b82c59ddaf7722b12db8c1387011fb34b.zip
usrp: fix rate calculation logic
Diffstat (limited to 'host/tests/ranges_test.cpp')
-rw-r--r--host/tests/ranges_test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/host/tests/ranges_test.cpp b/host/tests/ranges_test.cpp
index 5f6de4645..85bb4c3c4 100644
--- a/host/tests/ranges_test.cpp
+++ b/host/tests/ranges_test.cpp
@@ -55,3 +55,16 @@ BOOST_AUTO_TEST_CASE(test_ranges_clip){
BOOST_CHECK_CLOSE(mr.clip(50.9, false), 50.9, tolerance);
BOOST_CHECK_CLOSE(mr.clip(50.9, true), 51.0, tolerance);
}
+
+BOOST_AUTO_TEST_CASE(test_ranges_clip2){
+ meta_range_t mr;
+ mr.push_back(range_t(1.));
+ mr.push_back(range_t(2.));
+ mr.push_back(range_t(3.));
+
+ BOOST_CHECK_CLOSE(mr.clip(2., true), 2., tolerance);
+ BOOST_CHECK_CLOSE(mr.clip(0., true), 1., tolerance);
+ BOOST_CHECK_CLOSE(mr.clip(1.2, true), 1., tolerance);
+ BOOST_CHECK_CLOSE(mr.clip(3.1, true), 3., tolerance);
+ BOOST_CHECK_CLOSE(mr.clip(4., true), 3., tolerance);
+}