aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/rfnoc_chdr_test.cpp
diff options
context:
space:
mode:
authorSamuel O'Brien <sam.obrien@ni.com>2020-06-26 08:26:25 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-07-13 15:21:52 -0500
commitb0cb065111dc3f40b89bdda76e9bd98f3e70b72e (patch)
tree4d08118999692767bc018d0a21758562abe1a300 /host/tests/rfnoc_chdr_test.cpp
parent14d9452a15a6e65b01e19e0d5ce0c67afc060cc2 (diff)
downloaduhd-b0cb065111dc3f40b89bdda76e9bd98f3e70b72e.tar.gz
uhd-b0cb065111dc3f40b89bdda76e9bd98f3e70b72e.tar.bz2
uhd-b0cb065111dc3f40b89bdda76e9bd98f3e70b72e.zip
rfnoc: Rename chdr_packet to chdr_packet_writer
It would be confusing to have two classes named chdr_packet. As it makes more sense to name the new public chdr parser class chdr_packet, the internal uhd::rfnoc::chdr::chdr_packet class is being renamed to chdr_packet_writer to better represent its functionality. Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'host/tests/rfnoc_chdr_test.cpp')
-rw-r--r--host/tests/rfnoc_chdr_test.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/host/tests/rfnoc_chdr_test.cpp b/host/tests/rfnoc_chdr_test.cpp
index 27b883543..31640325c 100644
--- a/host/tests/rfnoc_chdr_test.cpp
+++ b/host/tests/rfnoc_chdr_test.cpp
@@ -6,7 +6,7 @@
#include <uhd/types/endianness.hpp>
#include <uhd/utils/byteswap.hpp>
-#include <uhdlib/rfnoc/chdr_packet.hpp>
+#include <uhdlib/rfnoc/chdr_packet_writer.hpp>
#include <uhdlib/rfnoc/chdr_types.hpp>
#include <boost/format.hpp>
#include <boost/test/unit_test.hpp>
@@ -237,27 +237,28 @@ BOOST_AUTO_TEST_CASE(chdr_strc_packet_no_swap_64)
BOOST_AUTO_TEST_CASE(chdr_generic_packet_calculate_pyld_offset_64)
{
// Check calculation without timestamp
- auto test_pyld_offset =
- [](chdr_packet::uptr& pkt, const packet_type_t pkt_type, const size_t num_mdata) {
- uint64_t buff[MAX_BUF_SIZE_WORDS];
- chdr_header header;
- header.set_pkt_type(pkt_type);
- header.set_num_mdata(num_mdata);
+ auto test_pyld_offset = [](chdr_packet_writer::uptr& pkt,
+ const packet_type_t pkt_type,
+ const size_t num_mdata) {
+ uint64_t buff[MAX_BUF_SIZE_WORDS];
+ chdr_header header;
+ header.set_pkt_type(pkt_type);
+ header.set_num_mdata(num_mdata);
- pkt->refresh(reinterpret_cast<void*>(buff), header, 0);
+ pkt->refresh(reinterpret_cast<void*>(buff), header, 0);
- const size_t pyld_offset = pkt->calculate_payload_offset(pkt_type, num_mdata);
+ const size_t pyld_offset = pkt->calculate_payload_offset(pkt_type, num_mdata);
- void* pyld_ptr = pkt->get_payload_ptr();
+ void* pyld_ptr = pkt->get_payload_ptr();
- const size_t non_pyld_bytes = static_cast<size_t>(
- reinterpret_cast<uint8_t*>(pyld_ptr) - reinterpret_cast<uint8_t*>(buff));
+ const size_t non_pyld_bytes = static_cast<size_t>(
+ reinterpret_cast<uint8_t*>(pyld_ptr) - reinterpret_cast<uint8_t*>(buff));
- BOOST_CHECK(pyld_offset == non_pyld_bytes);
- };
+ BOOST_CHECK(pyld_offset == non_pyld_bytes);
+ };
{
- chdr_packet::uptr pkt = chdr64_be_factory.make_generic();
+ chdr_packet_writer::uptr pkt = chdr64_be_factory.make_generic();
test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0);
test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1);
test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2);
@@ -266,7 +267,7 @@ BOOST_AUTO_TEST_CASE(chdr_generic_packet_calculate_pyld_offset_64)
test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 2);
}
{
- chdr_packet::uptr pkt = chdr256_be_factory.make_generic();
+ chdr_packet_writer::uptr pkt = chdr256_be_factory.make_generic();
test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0);
test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1);
test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2);