Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
wallet
test
init_tests.cpp
Go to the documentation of this file.
1
// Copyright (c) 2018-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#include <boost/test/unit_test.hpp>
6
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
>
12
13
namespace
wallet
{
14
BOOST_FIXTURE_TEST_SUITE
(init_tests,
InitWalletDirTestingSetup
)
15
16
BOOST_AUTO_TEST_CASE
(walletinit_verify_walletdir_default)
17
{
18
SetWalletDir(m_walletdir_path_cases[
"default"
]);
19
bool
result = m_wallet_loader->verify();
20
BOOST_CHECK
(result ==
true
);
21
fs::path walletdir = m_args.GetPathArg(
"-walletdir"
);
22
fs::path expected_path = fs::canonical(m_walletdir_path_cases[
"default"
]);
23
BOOST_CHECK_EQUAL
(walletdir, expected_path);
24
}
25
26
BOOST_AUTO_TEST_CASE
(walletinit_verify_walletdir_custom)
27
{
28
SetWalletDir(m_walletdir_path_cases[
"custom"
]);
29
bool
result = m_wallet_loader->verify();
30
BOOST_CHECK
(result ==
true
);
31
fs::path walletdir = m_args.GetPathArg(
"-walletdir"
);
32
fs::path expected_path = fs::canonical(m_walletdir_path_cases[
"custom"
]);
33
BOOST_CHECK_EQUAL
(walletdir, expected_path);
34
}
35
36
BOOST_AUTO_TEST_CASE
(walletinit_verify_walletdir_does_not_exist)
37
{
38
SetWalletDir(m_walletdir_path_cases[
"nonexistent"
]);
39
{
40
ASSERT_DEBUG_LOG
(
"does not exist"
);
41
bool
result = m_wallet_loader->verify();
42
BOOST_CHECK
(result ==
false
);
43
}
44
}
45
46
BOOST_AUTO_TEST_CASE
(walletinit_verify_walletdir_is_not_directory)
47
{
48
SetWalletDir(m_walletdir_path_cases[
"file"
]);
49
{
50
ASSERT_DEBUG_LOG
(
"is not a directory"
);
51
bool
result = m_wallet_loader->verify();
52
BOOST_CHECK
(result ==
false
);
53
}
54
}
55
56
BOOST_AUTO_TEST_CASE
(walletinit_verify_walletdir_is_not_relative)
57
{
58
SetWalletDir(m_walletdir_path_cases[
"relative"
]);
59
{
60
ASSERT_DEBUG_LOG
(
"is a relative path"
);
61
bool
result = m_wallet_loader->verify();
62
BOOST_CHECK
(result ==
false
);
63
}
64
}
65
66
BOOST_AUTO_TEST_CASE
(walletinit_verify_walletdir_no_trailing)
67
{
68
SetWalletDir(m_walletdir_path_cases[
"trailing"
]);
69
bool
result = m_wallet_loader->verify();
70
BOOST_CHECK
(result ==
true
);
71
fs::path walletdir = m_args.GetPathArg(
"-walletdir"
);
72
fs::path expected_path = fs::canonical(m_walletdir_path_cases[
"default"
]);
73
BOOST_CHECK_EQUAL
(walletdir, expected_path);
74
}
75
76
BOOST_AUTO_TEST_CASE
(walletinit_verify_walletdir_no_trailing2)
77
{
78
SetWalletDir(m_walletdir_path_cases[
"trailing2"
]);
79
bool
result = m_wallet_loader->verify();
80
BOOST_CHECK
(result ==
true
);
81
fs::path walletdir = m_args.GetPathArg(
"-walletdir"
);
82
fs::path expected_path = fs::canonical(m_walletdir_path_cases[
"default"
]);
83
BOOST_CHECK_EQUAL
(walletdir, expected_path);
84
}
85
86
BOOST_AUTO_TEST_SUITE_END
()
87
}
// namespace wallet
args.h
BOOST_FIXTURE_TEST_SUITE
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
init_test_fixture.h
wallet
Definition
wallet_balance.cpp:26
wallet::BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(bnb_test)
Definition
coinselection_tests.cpp:123
noui.h
BOOST_CHECK_EQUAL
#define BOOST_CHECK_EQUAL(v1, v2)
Definition
object.cpp:17
BOOST_CHECK
#define BOOST_CHECK(expr)
Definition
object.cpp:16
setup_common.h
wallet::InitWalletDirTestingSetup
Definition
init_test_fixture.h:16
logging.h
ASSERT_DEBUG_LOG
#define ASSERT_DEBUG_LOG(message)
Definition
logging.h:42
Generated on
for Bitcoin Core by
1.17.0