LCOV - code coverage report
Current view: top level - src/wallet/test - init_test_fixture.cpp (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 26 26 100.0 %
Date: 2022-04-21 14:51:19 Functions: 3 3 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 0 0 -

           Branch data     Line data    Source code
#       1                 :            : // Copyright (c) 2018-2021 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 <fs.h>
#       6                 :            : #include <univalue.h>
#       7                 :            : #include <util/check.h>
#       8                 :            : #include <util/system.h>
#       9                 :            : 
#      10                 :            : #include <fstream>
#      11                 :            : #include <string>
#      12                 :            : 
#      13                 :            : #include <wallet/test/init_test_fixture.h>
#      14                 :            : 
#      15                 :            : namespace wallet {
#      16                 :            : InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
#      17                 :          7 : {
#      18                 :          7 :     m_wallet_loader = MakeWalletLoader(*m_node.chain, m_args);
#      19                 :            : 
#      20                 :          7 :     std::string sep;
#      21                 :          7 :     sep += fs::path::preferred_separator;
#      22                 :            : 
#      23                 :          7 :     m_datadir = m_args.GetDataDirNet();
#      24                 :          7 :     m_cwd = fs::current_path();
#      25                 :            : 
#      26                 :          7 :     m_walletdir_path_cases["default"] = m_datadir / "wallets";
#      27                 :          7 :     m_walletdir_path_cases["custom"] = m_datadir / "my_wallets";
#      28                 :          7 :     m_walletdir_path_cases["nonexistent"] = m_datadir / "path_does_not_exist";
#      29                 :          7 :     m_walletdir_path_cases["file"] = m_datadir / "not_a_directory.dat";
#      30                 :          7 :     m_walletdir_path_cases["trailing"] = m_datadir / ("wallets" + sep);
#      31                 :          7 :     m_walletdir_path_cases["trailing2"] = m_datadir / ("wallets" + sep + sep);
#      32                 :            : 
#      33                 :          7 :     fs::current_path(m_datadir);
#      34                 :          7 :     m_walletdir_path_cases["relative"] = "wallets";
#      35                 :            : 
#      36                 :          7 :     fs::create_directories(m_walletdir_path_cases["default"]);
#      37                 :          7 :     fs::create_directories(m_walletdir_path_cases["custom"]);
#      38                 :          7 :     fs::create_directories(m_walletdir_path_cases["relative"]);
#      39                 :          7 :     std::ofstream f{m_walletdir_path_cases["file"]};
#      40                 :          7 :     f.close();
#      41                 :          7 : }
#      42                 :            : 
#      43                 :            : InitWalletDirTestingSetup::~InitWalletDirTestingSetup()
#      44                 :          7 : {
#      45                 :          7 :     fs::current_path(m_cwd);
#      46                 :          7 : }
#      47                 :            : 
#      48                 :            : void InitWalletDirTestingSetup::SetWalletDir(const fs::path& walletdir_path)
#      49                 :          7 : {
#      50                 :          7 :     m_args.ForceSetArg("-walletdir", fs::PathToString(walletdir_path));
#      51                 :          7 : }
#      52                 :            : } // namespace wallet

Generated by: LCOV version 0-eol-96201-ge66f56f4af6a