mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
test: Add BOOST_REQUIRE to getters returning optional
This commit is contained in:
parent
6d58a5c3b0
commit
fa21ca09a8
4 changed files with 12 additions and 11 deletions
|
@ -2,17 +2,18 @@
|
||||||
// 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 <attributes.h>
|
||||||
#include <coins.h>
|
#include <coins.h>
|
||||||
|
#include <consensus/validation.h>
|
||||||
#include <script/standard.h>
|
#include <script/standard.h>
|
||||||
|
#include <test/test_bitcoin.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
#include <undo.h>
|
#include <undo.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
#include <test/test_bitcoin.h>
|
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
#include <consensus/validation.h>
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ class CCoinsViewTest : public CCoinsView
|
||||||
std::map<COutPoint, Coin> map_;
|
std::map<COutPoint, Coin> map_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool GetCoin(const COutPoint& outpoint, Coin& coin) const override
|
NODISCARD bool GetCoin(const COutPoint& outpoint, Coin& coin) const override
|
||||||
{
|
{
|
||||||
std::map<COutPoint, Coin>::const_iterator it = map_.find(outpoint);
|
std::map<COutPoint, Coin>::const_iterator it = map_.find(outpoint);
|
||||||
if (it == map_.end()) {
|
if (it == map_.end()) {
|
||||||
|
|
|
@ -102,15 +102,15 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
|
||||||
char key_res;
|
char key_res;
|
||||||
uint256 val_res;
|
uint256 val_res;
|
||||||
|
|
||||||
it->GetKey(key_res);
|
BOOST_REQUIRE(it->GetKey(key_res));
|
||||||
it->GetValue(val_res);
|
BOOST_REQUIRE(it->GetValue(val_res));
|
||||||
BOOST_CHECK_EQUAL(key_res, key);
|
BOOST_CHECK_EQUAL(key_res, key);
|
||||||
BOOST_CHECK_EQUAL(val_res.ToString(), in.ToString());
|
BOOST_CHECK_EQUAL(val_res.ToString(), in.ToString());
|
||||||
|
|
||||||
it->Next();
|
it->Next();
|
||||||
|
|
||||||
it->GetKey(key_res);
|
BOOST_REQUIRE(it->GetKey(key_res));
|
||||||
it->GetValue(val_res);
|
BOOST_REQUIRE(it->GetValue(val_res));
|
||||||
BOOST_CHECK_EQUAL(key_res, key2);
|
BOOST_CHECK_EQUAL(key_res, key2);
|
||||||
BOOST_CHECK_EQUAL(val_res.ToString(), in2.ToString());
|
BOOST_CHECK_EQUAL(val_res.ToString(), in2.ToString());
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ struct TestArgsManager : public ArgsManager
|
||||||
m_config_args.clear();
|
m_config_args.clear();
|
||||||
}
|
}
|
||||||
std::string error;
|
std::string error;
|
||||||
ReadConfigStream(streamConfig, error);
|
BOOST_REQUIRE(ReadConfigStream(streamConfig, error));
|
||||||
}
|
}
|
||||||
void SetNetworkOnlyArg(const std::string arg)
|
void SetNetworkOnlyArg(const std::string arg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,7 +150,7 @@ protected:
|
||||||
std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
|
std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
|
||||||
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
|
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
|
||||||
|
|
||||||
bool ReadConfigStream(std::istream& stream, std::string& error, bool ignore_invalid_keys = false);
|
NODISCARD bool ReadConfigStream(std::istream& stream, std::string& error, bool ignore_invalid_keys = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArgsManager();
|
ArgsManager();
|
||||||
|
@ -161,7 +161,7 @@ public:
|
||||||
void SelectConfigNetwork(const std::string& network);
|
void SelectConfigNetwork(const std::string& network);
|
||||||
|
|
||||||
NODISCARD bool ParseParameters(int argc, const char* const argv[], std::string& error);
|
NODISCARD bool ParseParameters(int argc, const char* const argv[], std::string& error);
|
||||||
bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
|
NODISCARD bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log warnings for options in m_section_only_args when
|
* Log warnings for options in m_section_only_args when
|
||||||
|
|
Loading…
Add table
Reference in a new issue