2014-03-28 15:07:53 +00:00
|
|
|
//
|
|
|
|
|
// Copyright 2014 Ettus Research LLC
|
|
|
|
|
//
|
2017-12-22 17:45:24 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0
|
2014-03-28 15:07:53 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <boost/test/unit_test.hpp>
|
2016-10-31 21:30:52 +00:00
|
|
|
#include <stdint.h>
|
2014-03-28 15:07:53 +00:00
|
|
|
#include <uhd/utils/cast.hpp>
|
|
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(test_mac_addr){
|
|
|
|
|
std::string in = "0x0100";
|
2016-10-31 21:30:52 +00:00
|
|
|
uint16_t correct_result = 256;
|
|
|
|
|
uint16_t x = uhd::cast::hexstr_cast<uint16_t>(in);
|
|
|
|
|
//uint16_t x = uhd::cast::hexstr_cast(in);
|
2014-03-28 15:07:53 +00:00
|
|
|
std::cout
|
|
|
|
|
<< "Testing hex -> uint16_t conversion. "
|
|
|
|
|
<< in << " == " << std::hex << x << "?" << std::endl;
|
|
|
|
|
BOOST_CHECK_EQUAL(x, correct_result);
|
|
|
|
|
}
|
|
|
|
|
|