Bitcoin Core 32.99.0
P2P Digital Currency
Loading...
Searching...
No Matches
Classes | Functions | Variables
serialize_tests.cpp File Reference
#include <hash.h>
#include <serialize.h>
#include <streams.h>
#include <test/util/common.h>
#include <test/util/setup_common.h>
#include <util/strencodings.h>
#include <algorithm>
#include <cstdint>
#include <string>
#include <boost/test/unit_test.hpp>
Include dependency graph for serialize_tests.cpp:

Go to the source code of this file.

Classes

class  UncopyableStream
 
class  CSerializeMethodsTestSingle
 
class  CSerializeMethodsTestMany
 
struct  BaseFormat
 
class  Base
 (Un)serialize a number as raw byte or 2 hexadecimal chars. More...
 
class  DerivedAndBaseFormat
 
class  Derived
 
struct  OtherParam
 
class  OtherParamChecker
 Checker for value of OtherParam. More...
 

Functions

 BOOST_AUTO_TEST_CASE (sizes)
 
 BOOST_AUTO_TEST_CASE (varints)
 
 BOOST_AUTO_TEST_CASE (varints_bitpatterns)
 
 BOOST_AUTO_TEST_CASE (compactsize)
 
static bool isCanonicalException (const std::ios_base::failure &ex)
 
 BOOST_AUTO_TEST_CASE (vector_bool)
 
 BOOST_AUTO_TEST_CASE (array)
 
 BOOST_AUTO_TEST_CASE (noncanonical)
 
 BOOST_AUTO_TEST_CASE (truncated_compact_size)
 
 BOOST_AUTO_TEST_CASE (string_view)
 
 BOOST_AUTO_TEST_CASE (limited_vector)
 
 BOOST_AUTO_TEST_CASE (class_methods)
 
 BOOST_AUTO_TEST_CASE (with_params_multi)
 Test creating a stream with multiple parameters and making sure serialization code requiring different parameters can retrieve them.
 
 BOOST_AUTO_TEST_CASE (with_params_move)
 Test creating a ParamsStream that moves from a stream argument.
 
 BOOST_AUTO_TEST_CASE (with_params_base)
 
 BOOST_AUTO_TEST_CASE (with_params_vector_of_base)
 
 BOOST_AUTO_TEST_CASE (with_params_derived)
 

Variables

constexpr BaseFormat RAW {BaseFormat::RAW}
 
constexpr BaseFormat HEX {BaseFormat::HEX}
 
constexpr DerivedAndBaseFormat RAW_LOWER {{BaseFormat::RAW}, DerivedAndBaseFormat::DerivedFormat::LOWER}
 
constexpr DerivedAndBaseFormat HEX_UPPER {{BaseFormat::HEX}, DerivedAndBaseFormat::DerivedFormat::UPPER}
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/16]

BOOST_AUTO_TEST_CASE ( array  )

Definition at line 198 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/16]

BOOST_AUTO_TEST_CASE ( class_methods  )

Definition at line 288 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/16]

BOOST_AUTO_TEST_CASE ( compactsize  )

Definition at line 159 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/16]

BOOST_AUTO_TEST_CASE ( limited_vector  )

Definition at line 264 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/16]

BOOST_AUTO_TEST_CASE ( noncanonical  )

Definition at line 208 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/16]

BOOST_AUTO_TEST_CASE ( sizes  )

Definition at line 77 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/16]

BOOST_AUTO_TEST_CASE ( string_view  )

Definition at line 254 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/16]

BOOST_AUTO_TEST_CASE ( truncated_compact_size  )

Definition at line 245 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/16]

BOOST_AUTO_TEST_CASE ( varints  )

Definition at line 106 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/16]

BOOST_AUTO_TEST_CASE ( varints_bitpatterns  )

Definition at line 138 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/16]

BOOST_AUTO_TEST_CASE ( vector_bool  )

Definition at line 189 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/16]

BOOST_AUTO_TEST_CASE ( with_params_base  )

Definition at line 474 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/16]

BOOST_AUTO_TEST_CASE ( with_params_derived  )

Definition at line 528 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/16]

BOOST_AUTO_TEST_CASE ( with_params_move  )

Test creating a ParamsStream that moves from a stream argument.

Definition at line 458 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [15/16]

BOOST_AUTO_TEST_CASE ( with_params_multi  )

Test creating a stream with multiple parameters and making sure serialization code requiring different parameters can retrieve them.

Also test that earlier parameters take precedence if the same parameter type is specified twice. (Choice of whether earlier or later values take precedence or multiple values of the same type are allowed was arbitrary, and just decided based on what would require smallest amount of ugly C++ template code. Intent of the test is to just ensure there is no unexpected behavior.)

Definition at line 439 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [16/16]

BOOST_AUTO_TEST_CASE ( with_params_vector_of_base  )

Definition at line 497 of file serialize_tests.cpp.

Here is the call graph for this function:

◆ isCanonicalException()

static bool isCanonicalException ( const std::ios_base::failure &  ex)
static

Definition at line 178 of file serialize_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ HEX

constexpr BaseFormat HEX {BaseFormat::HEX}
constexpr

Definition at line 335 of file serialize_tests.cpp.

◆ HEX_UPPER

Definition at line 526 of file serialize_tests.cpp.

◆ RAW

constexpr BaseFormat RAW {BaseFormat::RAW}
constexpr

Definition at line 334 of file serialize_tests.cpp.

◆ RAW_LOWER

Definition at line 525 of file serialize_tests.cpp.