Bitcoin ABC  0.26.3
P2P Digital Currency
init_tests.cpp
Go to the documentation of this file.
1 // Copyright (c) 2022 The Bitcoin 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 <avalanche/avalanche.h>
6 #include <avalanche/proof.h>
7 #include <init.h>
8 #include <util/moneystr.h>
9 #include <util/string.h>
10 #include <util/system.h>
11 
12 #include <test/util/setup_common.h>
13 
14 #include <boost/test/unit_test.hpp>
15 
16 #include <cstdint>
17 
18 BOOST_FIXTURE_TEST_SUITE(init_tests, BasicTestingSetup)
19 
20 BOOST_AUTO_TEST_CASE(avalanche_flag_tests) {
21  gArgs.ForceSetArg("-ecash", "1");
22 
23  {
24  // Check the feature flags when avalanche is set
25  ArgsManager args;
26  args.ForceSetArg("-avalanche", "1");
28 
29  BOOST_CHECK_EQUAL(args.GetBoolArg("-automaticunparking", true), false);
30  }
31 
32  {
33  // Check the feature flags when avalanche is reset
34  ArgsManager args;
35  args.ForceSetArg("-avalanche", "0");
37 
38  BOOST_CHECK_EQUAL(args.GetBoolArg("-automaticunparking", false), true);
39  }
40 
41  {
42  // Check the feature flags can always be overridden
43  ArgsManager args;
44  args.ForceSetArg("-avalanche", "1");
45  args.ForceSetArg("-automaticunparking", "1");
47 
48  BOOST_CHECK_EQUAL(args.GetBoolArg("-automaticunparking", false), true);
49  }
50 
51  gArgs.ClearForcedArg("-ecash");
52 }
53 
BOOST_AUTO_TEST_CASE(avalanche_flag_tests)
Definition: init_tests.cpp:20
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition: system.cpp:706
void ClearForcedArg(const std::string &strArg)
Remove a forced arg setting, used only in testing.
Definition: system.cpp:757
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: system.cpp:665
void InitParameterInteraction(ArgsManager &args)
Parameter interaction: change current parameters depending on various rules.
Definition: init.cpp:1508
#define BOOST_AUTO_TEST_SUITE_END()
Definition: object.cpp:16
#define BOOST_CHECK_EQUAL(v1, v2)
Definition: object.cpp:18
BOOST_FIXTURE_TEST_SUITE(stakingrewards_tests, StakingRewardsActivationTestingSetup) BOOST_AUTO_TEST_CASE(isstakingrewardsactivated)
ArgsManager gArgs
Definition: system.cpp:80