Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/test/p2p_messaging_tests.cpp
// Copyright (c) 2019 The Bitcoin developers | // Copyright (c) 2019 The Bitcoin 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 <chainparams.h> | #include <chainparams.h> | ||||
#include <protocol.h> | #include <protocol.h> | ||||
#include <seeder/bitcoin.h> | #include <seeder/bitcoin.h> | ||||
#include <seeder/db.h> | #include <seeder/db.h> | ||||
#include <seeder/test/util.h> | #include <seeder/test/util.h> | ||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <version.h> | #include <version.h> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
#include <cstdint> | |||||
#include <memory> | #include <memory> | ||||
#include <ostream> | #include <ostream> | ||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
std::ostream &operator<<(std::ostream &os, const PeerMessagingState &state) { | std::ostream &operator<<(std::ostream &os, const PeerMessagingState &state) { | ||||
os << to_integral(state); | os << to_integral(state); | ||||
return os; | return os; | ||||
Show All 10 Lines | void TestProcessMessage(const std::string &strCommand, CDataStream &message, | ||||
PeerMessagingState ret = ProcessMessage(strCommand, message); | PeerMessagingState ret = ProcessMessage(strCommand, message); | ||||
BOOST_CHECK_EQUAL(ret, expectedState); | BOOST_CHECK_EQUAL(ret, expectedState); | ||||
} | } | ||||
CDataStream getSendBuffer() { return vSend; } | CDataStream getSendBuffer() { return vSend; } | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
static const unsigned short SERVICE_PORT = 18444; | static const uint16_t SERVICE_PORT = 18444; | ||||
struct SeederTestingSetup { | struct SeederTestingSetup { | ||||
SeederTestingSetup() { | SeederTestingSetup() { | ||||
SelectParams(CBaseChainParams::REGTEST); | SelectParams(CBaseChainParams::REGTEST); | ||||
CNetAddr ip; | CNetAddr ip; | ||||
ip.SetInternal("bitcoin.test"); | ip.SetInternal("bitcoin.test"); | ||||
CService service = {ip, SERVICE_PORT}; | CService service = {ip, SERVICE_PORT}; | ||||
vAddr.emplace_back(service, ServiceFlags()); | vAddr.emplace_back(service, ServiceFlags()); | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |