Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2018-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <boost/test/unit_test.hpp>7#include <common/args.h>8#include <noui.h>9#include <test/util/logging.h>10#include <test/util/setup_common.h>11#include <wallet/test/init_test_fixture.h>13namespace wallet {14BOOST_FIXTURE_TEST_SUITE(init_tests, InitWalletDirTestingSetup)16BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)17{18SetWalletDir(m_walletdir_path_cases["default"]);19bool result = m_wallet_loader->verify();20BOOST_CHECK(result == true);21fs::path walletdir = m_args.GetPathArg("-walletdir");22fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);23BOOST_CHECK_EQUAL(walletdir, expected_path);24}26BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom)27{28SetWalletDir(m_walletdir_path_cases["custom"]);29bool result = m_wallet_loader->verify();30BOOST_CHECK(result == true);31fs::path walletdir = m_args.GetPathArg("-walletdir");32fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);33BOOST_CHECK_EQUAL(walletdir, expected_path);34}36BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_does_not_exist)37{38SetWalletDir(m_walletdir_path_cases["nonexistent"]);39{40ASSERT_DEBUG_LOG("does not exist");41bool result = m_wallet_loader->verify();42BOOST_CHECK(result == false);43}44}46BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_directory)47{48SetWalletDir(m_walletdir_path_cases["file"]);49{50ASSERT_DEBUG_LOG("is not a directory");51bool result = m_wallet_loader->verify();52BOOST_CHECK(result == false);53}54}56BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_relative)57{58SetWalletDir(m_walletdir_path_cases["relative"]);59{60ASSERT_DEBUG_LOG("is a relative path");61bool result = m_wallet_loader->verify();62BOOST_CHECK(result == false);63}64}66BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing)67{68SetWalletDir(m_walletdir_path_cases["trailing"]);69bool result = m_wallet_loader->verify();70BOOST_CHECK(result == true);71fs::path walletdir = m_args.GetPathArg("-walletdir");72fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);73BOOST_CHECK_EQUAL(walletdir, expected_path);74}76BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2)77{78SetWalletDir(m_walletdir_path_cases["trailing2"]);79bool result = m_wallet_loader->verify();80BOOST_CHECK(result == true);81fs::path walletdir = m_args.GetPathArg("-walletdir");82fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);83BOOST_CHECK_EQUAL(walletdir, expected_path);84}86BOOST_AUTO_TEST_SUITE_END()87} // namespace wallet
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.