Bitcoin ABC  0.26.3
P2P Digital Currency
server_tests.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019 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 <rpc/server.h>
6 #include <test/util/setup_common.h>
7 #include <util/system.h>
8 
9 #include <boost/test/unit_test.hpp>
10 
11 #include <cstdint>
12 #include <vector>
13 
14 BOOST_FIXTURE_TEST_SUITE(server_tests, BasicTestingSetup)
15 
16 BOOST_AUTO_TEST_CASE(server_IsDeprecatedRPCEnabled) {
17  ArgsManager testArgs;
18  testArgs.AddArg("-deprecatedrpc", "", ArgsManager::ALLOW_ANY,
20 
21  const char *argv_test[] = {"bitcoind", "-deprecatedrpc=foo",
22  "-deprecatedrpc=bar"};
23 
24  std::string error;
25  BOOST_CHECK_MESSAGE(testArgs.ParseParameters(3, (char **)argv_test, error),
26  error);
27 
28  BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "foo") == true);
29  BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bar") == true);
30  BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bob") == false);
31 }
32 
@ ALLOW_ANY
Definition: system.h:159
bool ParseParameters(int argc, const char *const argv[], std::string &error)
Definition: system.cpp:322
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
Definition: system.cpp:729
#define BOOST_AUTO_TEST_SUITE_END()
Definition: object.cpp:16
#define BOOST_CHECK(expr)
Definition: object.cpp:17
bool IsDeprecatedRPCEnabled(const ArgsManager &args, const std::string &method)
Definition: server.cpp:410
BOOST_AUTO_TEST_CASE(server_IsDeprecatedRPCEnabled)
BOOST_FIXTURE_TEST_SUITE(stakingrewards_tests, StakingRewardsActivationTestingSetup) BOOST_AUTO_TEST_CASE(isstakingrewardsactivated)
bool error(const char *fmt, const Args &...args)
Definition: system.h:45