Changeset View
Changeset View
Standalone View
Standalone View
src/test/util_tests.cpp
// Copyright (c) 2011-2019 The Bitcoin Core developers | // Copyright (c) 2011-2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <hash.h> // For Hash() | #include <hash.h> // For Hash() | ||||
#include <key.h> // For CKey | #include <key.h> // For CKey | ||||
#include <optional.h> | |||||
#include <sync.h> | #include <sync.h> | ||||
#include <test/util/logging.h> | #include <test/util/logging.h> | ||||
#include <test/util/str.h> | #include <test/util/str.h> | ||||
#include <uint256.h> | #include <uint256.h> | ||||
#include <util/message.h> // For MessageSign(), MessageVerify(), MESSAGE_MAGIC | #include <util/message.h> // For MessageSign(), MessageVerify(), MESSAGE_MAGIC | ||||
#include <util/moneystr.h> | #include <util/moneystr.h> | ||||
#include <util/spanparsing.h> | #include <util/spanparsing.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | |||||
class CheckValueTest : public TestChain100Setup { | class CheckValueTest : public TestChain100Setup { | ||||
public: | public: | ||||
struct Expect { | struct Expect { | ||||
util::SettingsValue setting; | util::SettingsValue setting; | ||||
bool default_string = false; | bool default_string = false; | ||||
bool default_int = false; | bool default_int = false; | ||||
bool default_bool = false; | bool default_bool = false; | ||||
const char *string_value = nullptr; | const char *string_value = nullptr; | ||||
Optional<int64_t> int_value; | std::optional<int64_t> int_value; | ||||
Optional<bool> bool_value; | std::optional<bool> bool_value; | ||||
Optional<std::vector<std::string>> list_value; | std::optional<std::vector<std::string>> list_value; | ||||
const char *error = nullptr; | const char *error = nullptr; | ||||
explicit Expect(util::SettingsValue s) : setting(std::move(s)) {} | explicit Expect(util::SettingsValue s) : setting(std::move(s)) {} | ||||
Expect &DefaultString() { | Expect &DefaultString() { | ||||
default_string = true; | default_string = true; | ||||
return *this; | return *this; | ||||
} | } | ||||
Expect &DefaultInt() { | Expect &DefaultInt() { | ||||
▲ Show 20 Lines • Show All 2,256 Lines • Show Last 20 Lines |