Bitcoin Core 32.1.0
P2P Digital Currency
Loading...
Searching...
No Matches
test_kernel.cpp File Reference
#include <kernel/bitcoinkernel.h>
#include <kernel/bitcoinkernel_wrapper.h>
#include <util/byte_units.h>
#include <util/fs.h>
#include <boost/test/included/unit_test.hpp>
#include <test/kernel/block_data.h>
#include <test/util/common.h>
#include <charconv>
#include <cstdint>
#include <cstdlib>
#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
class  KernelMockTime

Concepts

concept  HasToBytes

Macros

#define BOOST_TEST_DISABLE_ALT_STACK
#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, const PrecomputedTransactionData *precomputed_txdata, 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_precomputed_txdata)
 BOOST_AUTO_TEST_CASE (btck_script_verify_tests)
 BOOST_AUTO_TEST_CASE (logging_tests)
 BOOST_AUTO_TEST_CASE (btck_chainparams_tests)
 BOOST_AUTO_TEST_CASE (btck_context_tests)
 BOOST_AUTO_TEST_CASE (btck_block_header_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< ChainMan > create_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_check_block_context_free)
 BOOST_AUTO_TEST_CASE (btck_chainman_mainnet_tests)
 BOOST_AUTO_TEST_CASE (btck_block_hash_tests)
 BOOST_AUTO_TEST_CASE (btck_block_tree_entry_tests)
 BOOST_AUTO_TEST_CASE (btck_chainman_in_memory_tests)
 BOOST_AUTO_TEST_CASE (btck_chainman_regtest_tests)
 BOOST_AUTO_TEST_CASE (btck_transaction_check_tests)
 BOOST_AUTO_TEST_CASE (btck_set_mock_time_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_DISABLE_ALT_STACK

#define BOOST_TEST_DISABLE_ALT_STACK

Definition at line 11 of file test_kernel.cpp.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Bitcoin Kernel Test Suite

Definition at line 12 of file test_kernel.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/20]

BOOST_AUTO_TEST_CASE ( btck_block )

Definition at line 743 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/20]

BOOST_AUTO_TEST_CASE ( btck_block_hash_tests )

Definition at line 1037 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/20]

BOOST_AUTO_TEST_CASE ( btck_block_header_tests )

Definition at line 705 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/20]

BOOST_AUTO_TEST_CASE ( btck_block_tree_entry_tests )

Definition at line 1052 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/20]

BOOST_AUTO_TEST_CASE ( btck_chainman_in_memory_tests )

Definition at line 1099 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/20]

BOOST_AUTO_TEST_CASE ( btck_chainman_mainnet_tests )

Definition at line 1029 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/20]

BOOST_AUTO_TEST_CASE ( btck_chainman_regtest_tests )

Definition at line 1123 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/20]

BOOST_AUTO_TEST_CASE ( btck_chainman_tests )

Definition at line 775 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/20]

BOOST_AUTO_TEST_CASE ( btck_chainparams_tests )

Definition at line 674 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/20]

BOOST_AUTO_TEST_CASE ( btck_check_block_context_free )

Definition at line 970 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/20]

BOOST_AUTO_TEST_CASE ( btck_context_tests )

Definition at line 681 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/20]

BOOST_AUTO_TEST_CASE ( btck_precomputed_txdata )

Definition at line 538 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/20]

BOOST_AUTO_TEST_CASE ( btck_script_pubkey )

Definition at line 477 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/20]

BOOST_AUTO_TEST_CASE ( btck_script_verify_tests )

Definition at line 554 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [15/20]

BOOST_AUTO_TEST_CASE ( btck_set_mock_time_tests )

Definition at line 1441 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [16/20]

BOOST_AUTO_TEST_CASE ( btck_transaction_check_tests )

Definition at line 1312 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [17/20]

BOOST_AUTO_TEST_CASE ( btck_transaction_input )

Definition at line 499 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [18/20]

BOOST_AUTO_TEST_CASE ( btck_transaction_output )

Definition at line 491 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [19/20]

BOOST_AUTO_TEST_CASE ( btck_transaction_tests )

Definition at line 395 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [20/20]

BOOST_AUTO_TEST_CASE ( logging_tests )

Definition at line 648 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 68 of file test_kernel.cpp.

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

◆ chainman_mainnet_validation_test()

void chainman_mainnet_validation_test ( TestDirectory & test_directory)

Definition at line 906 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 893 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 848 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 86 of file test_kernel.cpp.

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

◆ CheckHandle()

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

Definition at line 267 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 325 of file test_kernel.cpp.

Here is the call graph for this function:
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 822 of file test_kernel.cpp.

Here is the call graph for this function:
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 762 of file test_kernel.cpp.

Here is the call graph for this function:
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 51 of file test_kernel.cpp.

Here is the call graph for this function:

◆ random_string()

std::string random_string ( uint32_t length)

Definition at line 33 of file test_kernel.cpp.

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

◆ run_verify_test()

void run_verify_test ( const ScriptPubkey & spent_script_pubkey,
const Transaction & spending_tx,
const PrecomputedTransactionData * precomputed_txdata,
int64_t amount,
unsigned int input_index,
bool taproot )

Definition at line 212 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

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

Definition at line 81 of file test_kernel.cpp.

◆ VERIFY_ALL_PRE_TAPROOT

auto VERIFY_ALL_PRE_TAPROOT {VERIFY_ALL_PRE_SEGWIT | ScriptVerificationFlags::WITNESS}
constexpr

Definition at line 84 of file test_kernel.cpp.