Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
init_tests.cpp
Go to the documentation of this file.
1// Copyright (c) 2018 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 <common/system.h>
6#include <noui.h>
7#include <test/util/logging.h>
8
9#include <test/util/setup_common.h>
11
12#include <boost/test/unit_test.hpp>
13
15
17 SetWalletDir(m_walletdir_path_cases["default"]);
18 bool result = m_wallet_client->verify();
19 BOOST_CHECK(result == true);
20 fs::path walletdir = gArgs.GetPathArg("-walletdir");
21 fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
23}
24
26 SetWalletDir(m_walletdir_path_cases["custom"]);
27 bool result = m_wallet_client->verify();
28 BOOST_CHECK(result == true);
29 fs::path walletdir = gArgs.GetPathArg("-walletdir");
30 fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);
32}
33
35 SetWalletDir(m_walletdir_path_cases["nonexistent"]);
36 {
37 ASSERT_DEBUG_LOG("does not exist");
38 bool result = m_wallet_client->verify();
39 BOOST_CHECK(result == false);
40 }
41}
42
44 SetWalletDir(m_walletdir_path_cases["file"]);
45 {
46 ASSERT_DEBUG_LOG("is not a directory");
47 bool result = m_wallet_client->verify();
48 BOOST_CHECK(result == false);
49 }
50}
51
53 SetWalletDir(m_walletdir_path_cases["relative"]);
54 {
55 ASSERT_DEBUG_LOG("is a relative path");
56 bool result = m_wallet_client->verify();
57 BOOST_CHECK(result == false);
58 }
59}
60
62 SetWalletDir(m_walletdir_path_cases["trailing"]);
63 bool result = m_wallet_client->verify();
64 BOOST_CHECK(result == true);
65 fs::path walletdir = gArgs.GetPathArg("-walletdir");
66 fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
68}
69
71 SetWalletDir(m_walletdir_path_cases["trailing2"]);
72 bool result = m_wallet_client->verify();
73 BOOST_CHECK(result == true);
74 fs::path walletdir = gArgs.GetPathArg("-walletdir");
75 fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
77}
78
ArgsManager gArgs
Definition args.cpp:38
fs::path GetPathArg(std::string arg, const fs::path &default_value={}) const
Return path argument or default value.
Definition args.cpp:275
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Definition fs.h:30
#define BOOST_CHECK(expr)
Definition object.cpp:17
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)