9#include <boost/test/unit_test.hpp>
11static const char *
TEST_HOST =
"-host=seeder.bitcoinabc.org";
23BOOST_AUTO_TEST_SUITE(options_tests)
26 const char *argv[] = {
"ignored"};
48 const std::map<int, int> expectedResults = {
49 {-9999, EXIT_FAILURE},
56 for (
const auto entry : expectedResults) {
57 const std::string testArg =
"-dumpinterval=" +
ToString(entry.first);
60 BOOST_CHECK(opts.ParseCommandLine(5, argv) == entry.second);
62 BOOST_CHECK(opts.dumpInterval == std::chrono::seconds(entry.first));
68 const std::map<int, int> expectedResults = {
69 {-9999, EXIT_FAILURE},
76 for (
const auto entry : expectedResults) {
77 const std::string testArg =
"-threads=" +
ToString(entry.first);
80 BOOST_CHECK(opts.ParseCommandLine(5, argv) == entry.second);
88 const std::map<int, int> expectedResults = {
89 {-9999, EXIT_FAILURE},
96 for (
const auto entry : expectedResults) {
97 const std::string testArg =
"-dnsthreads=" +
ToString(entry.first);
100 BOOST_CHECK(opts.ParseCommandLine(5, argv) == entry.second);
108 const std::map<int, int> expectedResults = {
109 {-9999, EXIT_FAILURE},
119 {65536, EXIT_FAILURE},
120 {999999, EXIT_FAILURE}};
122 for (
const auto entry : expectedResults) {
123 const std::string testArg =
"-port=" +
ToString(entry.first);
126 BOOST_CHECK(opts.ParseCommandLine(5, argv) == entry.second);
133BOOST_AUTO_TEST_SUITE_END()
seeder::CDnsSeedOpts opts
static const bool DEFAULT_WIPE_BAN
static const int CONTINUE_EXECUTION
static const int DEFAULT_NUM_DNS_THREADS
static const int DEFAULT_DUMP_INTERVAL_SECONDS
static const bool DEFAULT_WIPE_IGNORE
static const int DEFAULT_NUM_THREADS
static const int DEFAULT_PORT
#define BOOST_CHECK(expr)
BOOST_FIXTURE_TEST_CASE(options_defaults_test, ArgsTestingSetup)
static const char * TEST_HOST
static const char * TEST_EMAIL
static const char * TEST_NAMESERVER
std::string ToString(const T &t)
Locale-independent version of std::to_string.