LCOV - code coverage report
Current view: top level - src/wallet/test - init_tests.cpp (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 56 56 100.0 %
Date: 2022-04-21 14:51:19 Functions: 7 7 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 <boost/test/unit_test.hpp>
#       6                 :            : 
#       7                 :            : #include <noui.h>
#       8                 :            : #include <test/util/logging.h>
#       9                 :            : #include <test/util/setup_common.h>
#      10                 :            : #include <util/system.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                 :          1 : {
#      18                 :          1 :     SetWalletDir(m_walletdir_path_cases["default"]);
#      19                 :          1 :     bool result = m_wallet_loader->verify();
#      20                 :          1 :     BOOST_CHECK(result == true);
#      21                 :          1 :     fs::path walletdir = m_args.GetPathArg("-walletdir");
#      22                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
#      23                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      24                 :          1 : }
#      25                 :            : 
#      26                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom)
#      27                 :          1 : {
#      28                 :          1 :     SetWalletDir(m_walletdir_path_cases["custom"]);
#      29                 :          1 :     bool result = m_wallet_loader->verify();
#      30                 :          1 :     BOOST_CHECK(result == true);
#      31                 :          1 :     fs::path walletdir = m_args.GetPathArg("-walletdir");
#      32                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);
#      33                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      34                 :          1 : }
#      35                 :            : 
#      36                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_does_not_exist)
#      37                 :          1 : {
#      38                 :          1 :     SetWalletDir(m_walletdir_path_cases["nonexistent"]);
#      39                 :          1 :     {
#      40                 :          1 :         ASSERT_DEBUG_LOG("does not exist");
#      41                 :          1 :         bool result = m_wallet_loader->verify();
#      42                 :          1 :         BOOST_CHECK(result == false);
#      43                 :          1 :     }
#      44                 :          1 : }
#      45                 :            : 
#      46                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_directory)
#      47                 :          1 : {
#      48                 :          1 :     SetWalletDir(m_walletdir_path_cases["file"]);
#      49                 :          1 :     {
#      50                 :          1 :         ASSERT_DEBUG_LOG("is not a directory");
#      51                 :          1 :         bool result = m_wallet_loader->verify();
#      52                 :          1 :         BOOST_CHECK(result == false);
#      53                 :          1 :     }
#      54                 :          1 : }
#      55                 :            : 
#      56                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_relative)
#      57                 :          1 : {
#      58                 :          1 :     SetWalletDir(m_walletdir_path_cases["relative"]);
#      59                 :          1 :     {
#      60                 :          1 :         ASSERT_DEBUG_LOG("is a relative path");
#      61                 :          1 :         bool result = m_wallet_loader->verify();
#      62                 :          1 :         BOOST_CHECK(result == false);
#      63                 :          1 :     }
#      64                 :          1 : }
#      65                 :            : 
#      66                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing)
#      67                 :          1 : {
#      68                 :          1 :     SetWalletDir(m_walletdir_path_cases["trailing"]);
#      69                 :          1 :     bool result = m_wallet_loader->verify();
#      70                 :          1 :     BOOST_CHECK(result == true);
#      71                 :          1 :     fs::path walletdir = m_args.GetPathArg("-walletdir");
#      72                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
#      73                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      74                 :          1 : }
#      75                 :            : 
#      76                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2)
#      77                 :          1 : {
#      78                 :          1 :     SetWalletDir(m_walletdir_path_cases["trailing2"]);
#      79                 :          1 :     bool result = m_wallet_loader->verify();
#      80                 :          1 :     BOOST_CHECK(result == true);
#      81                 :          1 :     fs::path walletdir = m_args.GetPathArg("-walletdir");
#      82                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
#      83                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      84                 :          1 : }
#      85                 :            : 
#      86                 :            : BOOST_AUTO_TEST_SUITE_END()
#      87                 :            : } // namespace wallet

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