Bitcoin ABC  0.24.10
P2P Digital Currency
options_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 <seeder/options.h>
6 #include <util/system.h>
7 
8 #include <boost/test/unit_test.hpp>
9 
11 public:
14 
16 };
17 
18 BOOST_AUTO_TEST_SUITE(options_tests)
19 
20 BOOST_FIXTURE_TEST_CASE(options_defaults_test, ArgsTestingSetup) {
21  const char *argv[] = {"ignored"};
22  BOOST_CHECK(opts.ParseCommandLine(1, argv) == seeder::CONTINUE_EXECUTION);
23  BOOST_CHECK(opts.nPort == seeder::DEFAULT_PORT);
24  BOOST_CHECK(opts.nThreads == seeder::DEFAULT_NUM_THREADS);
25  BOOST_CHECK(opts.nDnsThreads == seeder::DEFAULT_NUM_DNS_THREADS);
26  BOOST_CHECK(opts.fWipeBan == seeder::DEFAULT_WIPE_BAN);
27  BOOST_CHECK(opts.fWipeIgnore == seeder::DEFAULT_WIPE_IGNORE);
28 }
29 
31  const char *argv[] = {"ignored", "-host=seeder.bitcoinabc.org",
32  "-ns=localhost", "-mbox=email@bitcoinabc.org",
33  "-port=5555"};
34  BOOST_CHECK(opts.ParseCommandLine(5, argv) == seeder::CONTINUE_EXECUTION);
35  BOOST_CHECK(opts.host == "seeder.bitcoinabc.org");
36  BOOST_CHECK(opts.ns == "localhost");
37  BOOST_CHECK(opts.mbox == "email@bitcoinabc.org");
38  BOOST_CHECK(opts.nPort == 5555);
39 }
40 
seeder::DEFAULT_WIPE_BAN
static const bool DEFAULT_WIPE_BAN
Definition: options.h:20
seeder::CDnsSeedOpts::SetupSeederArgs
void SetupSeederArgs()
Definition: options.cpp:82
seeder::DEFAULT_NUM_THREADS
static const int DEFAULT_NUM_THREADS
Definition: options.h:17
ArgsTestingSetup
Definition: options_tests.cpp:10
options.h
seeder::DEFAULT_PORT
static const int DEFAULT_PORT
Definition: options.h:18
seeder::DEFAULT_NUM_DNS_THREADS
static const int DEFAULT_NUM_DNS_THREADS
Definition: options.h:19
seeder::CDnsSeedOpts
Definition: options.h:30
ArgsTestingSetup::opts
seeder::CDnsSeedOpts opts
Definition: options_tests.cpp:13
seeder::CONTINUE_EXECUTION
static const int CONTINUE_EXECUTION
Definition: options.h:15
ArgsTestingSetup::ArgsTestingSetup
ArgsTestingSetup()
Definition: options_tests.cpp:15
system.h
ArgsManager
Definition: system.h:148
ArgsTestingSetup::argsManager
ArgsManager argsManager
Definition: options_tests.cpp:12
BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(options_defaults_test, ArgsTestingSetup)
Definition: options_tests.cpp:20
BOOST_CHECK
#define BOOST_CHECK(expr)
Definition: object.cpp:17
BOOST_AUTO_TEST_SUITE_END
#define BOOST_AUTO_TEST_SUITE_END()
Definition: object.cpp:16
seeder::DEFAULT_WIPE_IGNORE
static const bool DEFAULT_WIPE_IGNORE
Definition: options.h:21