aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/pyranges_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'host/tests/pyranges_test.py')
-rw-r--r--host/tests/pyranges_test.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/host/tests/pyranges_test.py b/host/tests/pyranges_test.py
new file mode 100644
index 000000000..17137e9f2
--- /dev/null
+++ b/host/tests/pyranges_test.py
@@ -0,0 +1,20 @@
+#
+# Copyright 2020 Ettus Research, a National Instruments Brand
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+"""
+Unit test for uhd.types.*Range
+"""
+
+import unittest
+import uhd
+
+class RangesTest(unittest.TestCase):
+ """ Test Python-wrapped ranges classes """
+ def test_meta_range(self):
+ """ Test MetaRange.clip() """
+ my_range = uhd.types.MetaRange(1.0, 10.0, 0.5)
+ self.assertEqual(my_range.clip(5.0), 5.0)
+ self.assertEqual(my_range.clip(11.0), 10.0)
+ self.assertEqual(my_range.clip(5.1, True), 5.0)