diff options
Diffstat (limited to 'host/tests/serial_number_test.cpp')
-rw-r--r-- | host/tests/serial_number_test.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/host/tests/serial_number_test.cpp b/host/tests/serial_number_test.cpp new file mode 100644 index 000000000..11c7f5372 --- /dev/null +++ b/host/tests/serial_number_test.cpp @@ -0,0 +1,22 @@ +// +// Copyright 2020 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include <uhdlib/utils/serial_number.hpp> +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(test_serial_numbers_match) +{ + BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("abcd123", "abcd123")); + BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("0abcd123", "0abcd123")); + BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("0abcd123", "abcd1230")); + BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("abcd123", "abcd124")); + BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("abcd123", "321dcba")); + BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("abcd123", "0abcd123")); + BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("0abcd123", "abcd123")); + + // Out of range + BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("aaaaaaaaaaaaaa", "abcd123")); +} |