Test scenarios for extract_val
and append_val
functions.
More...
#include "catch2/catch_test_macros.hpp"
#include <cstddef>
#include <cstdint>
#include <ranges>
#include "serialize/extract_append.hpp"
#include "utility/byte_array.hpp"
|
| TEST_CASE ("Append values into a buffer", "[append_val]") |
|
| TEST_CASE ("Extract values from a buffer", "[extract_val]") |
|
template<typename Dest , typename Src > |
void | test_round_trip_var_int (Src src, std::size_t exp_sz) |
|
| TEST_CASE ("Append and extract variable length integers","[append_var_int]") |
|
| TEST_CASE ("Append and extract variable length integers, round trip testing", "[append_var_int]") |
|
| TEST_CASE ("Append var len integer of 127","[append_var_int]") |
|
| TEST_CASE ("Append var len integer of 128","[append_var_int]") |
|
| TEST_CASE ("Append var len integer larger than 4 bytes","[append_var_int]") |
|
| TEST_CASE ("Extracting variable integer larger than two bytes", "[extract_var_int]") |
|
| TEST_CASE ("Extracting variable integer smaller than a byte", "[extract_var_int]") |
|
| TEST_CASE ("Extracting variable integer of 128", "[extract_var_int]") |
|
|
constexpr std::uint32_t | val1 = 0xDDCCBBAA |
|
constexpr char | val2 = static_cast<char>(0xEE) |
|
constexpr std::int16_t | val3 = 0x01FF |
|
constexpr std::uint64_t | val4 = 0x0908070605040302 |
|
constexpr std::int32_t | val5 = 0xDEADBEEF |
|
constexpr std::byte | val6 = static_cast<std::byte>(0xAA) |
|
constexpr int | arr_sz |
|
auto | net_buf_big |
|
auto | net_buf_little |
|
Test scenarios for extract_val
and append_val
functions.
- Author
- Cliff Green, Roxanne Agerone
- Copyright
- (c) 2019-2025 by Cliff Green, Roxanne Agerone
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
◆ arr_sz
Initial value:= sizeof(val1)+sizeof(val2)+sizeof(val3)+
sizeof(val4)+sizeof(val5)+sizeof(val6)
◆ net_buf_big
Initial value:= chops::make_byte_array(0xDD, 0xCC, 0xBB, 0xAA, 0xEE, 0x01, 0xFF,
0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0xDE, 0xAD, 0xBE, 0xEF, 0xAA)
◆ net_buf_little
Initial value:= chops::make_byte_array(0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x01,
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xEF, 0xBE, 0xAD, 0xDE, 0xAA)