This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backgroundWorkInterval() function to tests
Add the function to TestCapability and TestCap definitions. Also remove unnecessary std:: prefix and update license messages.
- Loading branch information
1 parent
e007a9a
commit c254be9
Showing
2 changed files
with
32 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,6 @@ | ||
/* | ||
This file is part of cpp-ethereum. | ||
cpp-ethereum is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
cpp-ethereum is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
/** @file peer.cpp | ||
* @author Gav Wood <[email protected]> | ||
* @date 2014 | ||
* Peer Network test functions. | ||
*/ | ||
// Aleth: Ethereum C++ client, tools and libraries. | ||
// Copyright 2019 Aleth Authors. | ||
// Licensed under the GNU General Public License, Version 3. | ||
|
||
#include <libp2p/Capability.h> | ||
#include <libp2p/Host.h> | ||
|
@@ -33,13 +15,23 @@ using namespace dev; | |
using namespace dev::test; | ||
using namespace dev::p2p; | ||
|
||
namespace | ||
{ | ||
chrono::milliseconds c_backgroundWorkInterval{1000}; | ||
} | ||
|
||
class TestCap : public CapabilityFace, public Worker | ||
{ | ||
public: | ||
std::string name() const override { return "p2pTestCapability"; } | ||
string name() const override { return "p2pTestCapability"; } | ||
unsigned version() const override { return 2; } | ||
unsigned messageCount() const override { return UserPacket + 1; } | ||
|
||
chrono::milliseconds backgroundWorkInterval() const override | ||
{ | ||
return c_backgroundWorkInterval; | ||
} | ||
|
||
void onStarting() override {} | ||
void onStopping() override {} | ||
|
||
|
@@ -153,11 +145,11 @@ BOOST_AUTO_TEST_CASE(registerCapabilityAfterNetworkStart) | |
|
||
BOOST_AUTO_TEST_CASE(saveNodes) | ||
{ | ||
std::list<Host*> hosts; | ||
list<Host*> hosts; | ||
unsigned const c_step = 10; | ||
unsigned const c_nodes = 6; | ||
unsigned const c_peers = c_nodes - 1; | ||
std::set<short unsigned> ports; | ||
set<short unsigned> ports; | ||
|
||
for (unsigned i = 0; i < c_nodes; ++i) | ||
{ | ||
|
@@ -323,8 +315,8 @@ BOOST_AUTO_TEST_CASE(emptySharedPeer) | |
{ | ||
shared_ptr<Peer> p; | ||
BOOST_REQUIRE(!p); | ||
std::map<NodeID, std::shared_ptr<Peer>> peers; | ||
|
||
map<NodeID, shared_ptr<Peer>> peers; | ||
p = peers[NodeID()]; | ||
BOOST_REQUIRE(!p); | ||
|
||
|