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) 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
6#include <avalanche/proof.h>
7#include <common/system.h>
8#include <init.h>
9#include <util/moneystr.h>
10#include <util/string.h>
11
12#include <test/util/setup_common.h>
13
14#include <boost/test/unit_test.hpp>
15
16#include <cstdint>
17
18BOOST_FIXTURE_TEST_SUITE(init_tests, BasicTestingSetup)
19
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
ArgsManager gArgs
Definition args.cpp:38
BOOST_AUTO_TEST_CASE(avalanche_flag_tests)
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition args.cpp:597
void ClearForcedArg(const std::string &strArg)
Remove a forced arg setting, used only in testing.
Definition args.cpp:648
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition args.cpp:556
void InitParameterInteraction(ArgsManager &args)
Parameter interaction: change current parameters depending on various rules.
Definition init.cpp:1552
#define BOOST_CHECK_EQUAL(v1, v2)
Definition object.cpp:18
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