Bitcoin Core 30.99.0
P2P Digital Currency
Classes | Concepts | Macros | Functions | Variables
test_kernel.cpp File Reference
#include <kernel/bitcoinkernel.h>
#include <kernel/bitcoinkernel_wrapper.h>
#include <boost/test/included/unit_test.hpp>
#include <test/kernel/block_data.h>
#include <charconv>
#include <cstdint>
#include <cstdlib>
#include <filesystem>
#include <format>
#include <iostream>
#include <memory>
#include <optional>
#include <random>
#include <ranges>
#include <span>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for test_kernel.cpp:

Go to the source code of this file.

Classes

class  TestLog
 
struct  TestDirectory
 
class  TestKernelNotifications
 
class  TestValidationInterface
 

Concepts

concept  HasToBytes
 

Macros

#define BOOST_TEST_MODULE   Bitcoin Kernel Test Suite
 

Functions

std::string random_string (uint32_t length)
 
std::vector< std::byte > hex_string_to_byte_vec (std::string_view hex)
 
std::string byte_span_to_hex_string_reversed (std::span< const std::byte > bytes)
 
void check_equal (std::span< const std::byte > _actual, std::span< const std::byte > _expected, bool equal=true)
 
void run_verify_test (const ScriptPubkey &spent_script_pubkey, const Transaction &spending_tx, std::span< TransactionOutput > spent_outputs, int64_t amount, unsigned int input_index, bool taproot)
 
template<typename T >
void CheckHandle (T object, T distinct_object)
 
template<typename RangeType >
requires std::ranges::random_access_range<RangeType>
void CheckRange (const RangeType &range, size_t expected_size)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_tests)
 
 BOOST_AUTO_TEST_CASE (btck_script_pubkey)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_output)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_input)
 
 BOOST_AUTO_TEST_CASE (btck_script_verify_tests)
 
 BOOST_AUTO_TEST_CASE (logging_tests)
 
 BOOST_AUTO_TEST_CASE (btck_context_tests)
 
 BOOST_AUTO_TEST_CASE (btck_block)
 
Context create_context (std::shared_ptr< TestKernelNotifications > notifications, ChainType chain_type, std::shared_ptr< TestValidationInterface > validation_interface=nullptr)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_tests)
 
std::unique_ptr< ChainMancreate_chainman (TestDirectory &test_directory, bool reindex, bool wipe_chainstate, bool block_tree_db_in_memory, bool chainstate_db_in_memory, Context &context)
 
void chainman_reindex_test (TestDirectory &test_directory)
 
void chainman_reindex_chainstate_test (TestDirectory &test_directory)
 
void chainman_mainnet_validation_test (TestDirectory &test_directory)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_mainnet_tests)
 
 BOOST_AUTO_TEST_CASE (btck_block_hash_tests)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_in_memory_tests)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_regtest_tests)
 

Variables

constexpr auto VERIFY_ALL_PRE_SEGWIT
 
constexpr auto VERIFY_ALL_PRE_TAPROOT {VERIFY_ALL_PRE_SEGWIT | ScriptVerificationFlags::WITNESS}
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Bitcoin Kernel Test Suite

Definition at line 8 of file test_kernel.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/13]

BOOST_AUTO_TEST_CASE ( btck_block  )

Definition at line 577 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/13]

BOOST_AUTO_TEST_CASE ( btck_block_hash_tests  )

Definition at line 785 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/13]

BOOST_AUTO_TEST_CASE ( btck_chainman_in_memory_tests  )

Definition at line 800 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/13]

BOOST_AUTO_TEST_CASE ( btck_chainman_mainnet_tests  )

Definition at line 777 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/13]

BOOST_AUTO_TEST_CASE ( btck_chainman_regtest_tests  )

Definition at line 822 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/13]

BOOST_AUTO_TEST_CASE ( btck_chainman_tests  )

Definition at line 599 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/13]

BOOST_AUTO_TEST_CASE ( btck_context_tests  )

Definition at line 553 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/13]

BOOST_AUTO_TEST_CASE ( btck_script_pubkey  )

Definition at line 464 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/13]

BOOST_AUTO_TEST_CASE ( btck_script_verify_tests  )

Definition at line 494 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/13]

BOOST_AUTO_TEST_CASE ( btck_transaction_input  )

Definition at line 482 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/13]

BOOST_AUTO_TEST_CASE ( btck_transaction_output  )

Definition at line 474 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/13]

BOOST_AUTO_TEST_CASE ( btck_transaction_tests  )

Definition at line 390 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/13]

BOOST_AUTO_TEST_CASE ( logging_tests  )

Definition at line 527 of file test_kernel.cpp.

Here is the call graph for this function:

◆ byte_span_to_hex_string_reversed()

std::string byte_span_to_hex_string_reversed ( std::span< const std::byte >  bytes)

Definition at line 65 of file test_kernel.cpp.

Here is the caller graph for this function:

◆ chainman_mainnet_validation_test()

void chainman_mainnet_validation_test ( TestDirectory test_directory)

Definition at line 709 of file test_kernel.cpp.

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

◆ chainman_reindex_chainstate_test()

void chainman_reindex_chainstate_test ( TestDirectory test_directory)

Definition at line 698 of file test_kernel.cpp.

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

◆ chainman_reindex_test()

void chainman_reindex_test ( TestDirectory test_directory)

Definition at line 655 of file test_kernel.cpp.

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

◆ check_equal()

void check_equal ( std::span< const std::byte >  _actual,
std::span< const std::byte >  _expected,
bool  equal = true 
)

Definition at line 83 of file test_kernel.cpp.

Here is the caller graph for this function:

◆ CheckHandle()

template<typename T >
void CheckHandle ( object,
distinct_object 
)

Definition at line 274 of file test_kernel.cpp.

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

◆ CheckRange()

template<typename RangeType >
requires std::ranges::random_access_range<RangeType>
void CheckRange ( const RangeType &  range,
size_t  expected_size 
)

Definition at line 320 of file test_kernel.cpp.

Here is the caller graph for this function:

◆ create_chainman()

std::unique_ptr< ChainMan > create_chainman ( TestDirectory test_directory,
bool  reindex,
bool  wipe_chainstate,
bool  block_tree_db_in_memory,
bool  chainstate_db_in_memory,
Context context 
)

Definition at line 629 of file test_kernel.cpp.

Here is the caller graph for this function:

◆ create_context()

Context create_context ( std::shared_ptr< TestKernelNotifications notifications,
ChainType  chain_type,
std::shared_ptr< TestValidationInterface validation_interface = nullptr 
)

Definition at line 586 of file test_kernel.cpp.

Here is the caller graph for this function:

◆ hex_string_to_byte_vec()

std::vector< std::byte > hex_string_to_byte_vec ( std::string_view  hex)

Definition at line 48 of file test_kernel.cpp.

Here is the caller graph for this function:

◆ random_string()

std::string random_string ( uint32_t  length)

Definition at line 30 of file test_kernel.cpp.

Here is the caller graph for this function:

◆ run_verify_test()

void run_verify_test ( const ScriptPubkey spent_script_pubkey,
const Transaction spending_tx,
std::span< TransactionOutput spent_outputs,
int64_t  amount,
unsigned int  input_index,
bool  taproot 
)

Definition at line 219 of file test_kernel.cpp.

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

Variable Documentation

◆ VERIFY_ALL_PRE_SEGWIT

constexpr auto VERIFY_ALL_PRE_SEGWIT
constexpr
Initial value:
{ScriptVerificationFlags::P2SH | ScriptVerificationFlags::DERSIG |
ScriptVerificationFlags::NULLDUMMY | ScriptVerificationFlags::CHECKLOCKTIMEVERIFY |
ScriptVerificationFlags::CHECKSEQUENCEVERIFY}

Definition at line 78 of file test_kernel.cpp.

◆ VERIFY_ALL_PRE_TAPROOT

constexpr auto VERIFY_ALL_PRE_TAPROOT {VERIFY_ALL_PRE_SEGWIT | ScriptVerificationFlags::WITNESS}
constexpr

Definition at line 81 of file test_kernel.cpp.