Shared Buffer
Loading...
Searching...
No Matches
shared_buffer_test.cpp File Reference

Test scenarios for mutable_shared_buffer and const_shared_buffer classes. More...

#include "catch2/catch_test_macros.hpp"
#include "catch2/catch_template_test_macros.hpp"
#include <cstddef>
#include <list>
#include <string_view>
#include <span>
#include <array>
#include <algorithm>
#include <bit>
#include <ranges>
#include "buffer/shared_buffer.hpp"
#include "utility/byte_array.hpp"
Include dependency graph for shared_buffer_test.cpp:

Typedefs

using test_data_type = std::array<std::byte, test_data_size>
 

Functions

template<typename SB >
bool check_sb_against_test_data (SB sb)
 
template<typename SB , typename PT >
SB generic_pointer_construction_test (const PT *ptr)
 
template<typename PT >
void generic_pointer_append_test (const PT *ptr)
 
template<typename SB >
void check_sb (SB sb)
 
template<typename SB >
void common_ctor_test ()
 
template<typename SB >
void common_comparison_test ()
 
template<typename SB >
void byte_vector_move_test ()
 
 TEMPLATE_TEST_CASE ("Generic pointer construction", "[common]", char, unsigned char, signed char, std::uint8_t)
 
 TEST_CASE ("Void pointer construction", "[common]")
 
 TEMPLATE_TEST_CASE ("Shared buffer common ctor methods", "[const_shared_buffer] [mutable_shared_buffer] [common]", chops::mutable_shared_buffer, chops::const_shared_buffer)
 
 TEMPLATE_TEST_CASE ("Shared buffer common comparison methods", "[const_shared_buffer] [mutable_shared_buffer] [common]", chops::mutable_shared_buffer, chops::const_shared_buffer)
 
 TEST_CASE ("Mutable shared buffer copy construction and assignment", "[mutable_shared_buffer] [copy]")
 
 TEST_CASE ("Mutable shared buffer resize and clear", "[mutable_shared_buffer] [resize_and_clear]")
 
 TEST_CASE ("Mutable shared buffer swap", "[mutable_shared_buffer] [swap]")
 
 TEST_CASE ("Mutable shared buffer append", "[mutable_shared_buffer] [append]")
 
 TEMPLATE_TEST_CASE ("Generic pointer append", "[mutable_shared_buffer] [pointer] [append]", char, unsigned char, signed char, std::uint8_t)
 
 TEST_CASE ("Compare a mutable shared_buffer with a const shared buffer", "[mutable_shared_buffer] [const_shared_buffer] [compare]")
 
 TEST_CASE ("Mutable shared buffer move into const shared buffer", "[mutable_shared_buffer] [const_shared_buffer] [move]")
 
 TEMPLATE_TEST_CASE ("Move a vector of bytes into a shared buffer", "[common] [move_byte_vec]", chops::mutable_shared_buffer, chops::const_shared_buffer)
 
 TEST_CASE ("Use get_byte_vec for external modification of buffer", "[mutable_shared_buffer] [get_byte_vec]")
 

Variables

constexpr std::size_t test_data_size { 12u }
 
constexpr test_data_type test_data { chops::make_byte_array( 40, 41, 42, 43, 44, 60, 59, 58, 57, 56, 42, 42 ) }
 
char test_data_char [test_data_size] { 40, 41, 42, 43, 44, 60, 59, 58, 57, 56, 42, 42 }
 
const char * test_data_char_ptr {test_data_char}
 

Detailed Description

Test scenarios for mutable_shared_buffer and const_shared_buffer classes.

Author
Cliff Green

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)