blob: 17137e9f238ade49cfdc10db18205a983266feeb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)
|