aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/cast_test.cpp
blob: 296574b4838e3bda4ce0902af2d8c297af9775df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//
// Copyright 2014 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//

#include <uhd/utils/cast.hpp>
#include <stdint.h>
#include <boost/test/unit_test.hpp>
#include <iostream>

BOOST_AUTO_TEST_CASE(test_mac_addr)
{
    std::string in          = "0x0100";
    uint16_t correct_result = 256;
    uint16_t x              = uhd::cast::hexstr_cast<uint16_t>(in);
    // uint16_t x = uhd::cast::hexstr_cast(in);
    std::cout << "Testing hex -> uint16_t conversion. " << in << " == " << std::hex << x
              << "?" << std::endl;
    BOOST_CHECK_EQUAL(x, correct_result);
}