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: 2021-06-29 14:35:33 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-2020 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                 :            : BOOST_FIXTURE_TEST_SUITE(init_tests, InitWalletDirTestingSetup)
#      14                 :            : 
#      15                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)
#      16                 :          1 : {
#      17                 :          1 :     SetWalletDir(m_walletdir_path_cases["default"]);
#      18                 :          1 :     bool result = m_wallet_client->verify();
#      19                 :          1 :     BOOST_CHECK(result == true);
#      20                 :          1 :     fs::path walletdir = gArgs.GetArg("-walletdir", "");
#      21                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
#      22                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      23                 :          1 : }
#      24                 :            : 
#      25                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom)
#      26                 :          1 : {
#      27                 :          1 :     SetWalletDir(m_walletdir_path_cases["custom"]);
#      28                 :          1 :     bool result = m_wallet_client->verify();
#      29                 :          1 :     BOOST_CHECK(result == true);
#      30                 :          1 :     fs::path walletdir = gArgs.GetArg("-walletdir", "");
#      31                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);
#      32                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      33                 :          1 : }
#      34                 :            : 
#      35                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_does_not_exist)
#      36                 :          1 : {
#      37                 :          1 :     SetWalletDir(m_walletdir_path_cases["nonexistent"]);
#      38                 :          1 :     {
#      39                 :          1 :         ASSERT_DEBUG_LOG("does not exist");
#      40                 :          1 :         bool result = m_wallet_client->verify();
#      41                 :          1 :         BOOST_CHECK(result == false);
#      42                 :          1 :     }
#      43                 :          1 : }
#      44                 :            : 
#      45                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_directory)
#      46                 :          1 : {
#      47                 :          1 :     SetWalletDir(m_walletdir_path_cases["file"]);
#      48                 :          1 :     {
#      49                 :          1 :         ASSERT_DEBUG_LOG("is not a directory");
#      50                 :          1 :         bool result = m_wallet_client->verify();
#      51                 :          1 :         BOOST_CHECK(result == false);
#      52                 :          1 :     }
#      53                 :          1 : }
#      54                 :            : 
#      55                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_relative)
#      56                 :          1 : {
#      57                 :          1 :     SetWalletDir(m_walletdir_path_cases["relative"]);
#      58                 :          1 :     {
#      59                 :          1 :         ASSERT_DEBUG_LOG("is a relative path");
#      60                 :          1 :         bool result = m_wallet_client->verify();
#      61                 :          1 :         BOOST_CHECK(result == false);
#      62                 :          1 :     }
#      63                 :          1 : }
#      64                 :            : 
#      65                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing)
#      66                 :          1 : {
#      67                 :          1 :     SetWalletDir(m_walletdir_path_cases["trailing"]);
#      68                 :          1 :     bool result = m_wallet_client->verify();
#      69                 :          1 :     BOOST_CHECK(result == true);
#      70                 :          1 :     fs::path walletdir = gArgs.GetArg("-walletdir", "");
#      71                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
#      72                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      73                 :          1 : }
#      74                 :            : 
#      75                 :            : BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2)
#      76                 :          1 : {
#      77                 :          1 :     SetWalletDir(m_walletdir_path_cases["trailing2"]);
#      78                 :          1 :     bool result = m_wallet_client->verify();
#      79                 :          1 :     BOOST_CHECK(result == true);
#      80                 :          1 :     fs::path walletdir = gArgs.GetArg("-walletdir", "");
#      81                 :          1 :     fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
#      82                 :          1 :     BOOST_CHECK_EQUAL(walletdir, expected_path);
#      83                 :          1 : }
#      84                 :            : 
#      85                 :            : BOOST_AUTO_TEST_SUITE_END()

Generated by: LCOV version 1.14