aboutsummaryrefslogtreecommitdiffstats
path: root/peer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'peer.cpp')
-rw-r--r--peer.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/peer.cpp b/peer.cpp
index 1d593534..494231e3 100644
--- a/peer.cpp
+++ b/peer.cpp
@@ -112,6 +112,29 @@ BOOST_AUTO_TEST_CASE(save_nodes)
BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE(peerTypes)
+
+BOOST_AUTO_TEST_CASE(emptySharedPeer)
+{
+ shared_ptr<Peer> p;
+ BOOST_REQUIRE(!p);
+
+ std::map<NodeId, std::shared_ptr<Peer>> peers;
+ p = peers[NodeId()];
+ BOOST_REQUIRE(!p);
+
+ p.reset(new Peer(UnspecifiedNode));
+ BOOST_REQUIRE(!p->id);
+ BOOST_REQUIRE(!*p);
+
+ p.reset(new Peer(Node(NodeId(EmptySHA3), UnspecifiedNodeIPEndpoint)));
+ BOOST_REQUIRE(!(!*p));
+ BOOST_REQUIRE(*p);
+ BOOST_REQUIRE(p);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
int peerTest(int argc, char** argv)
{
Public remoteAlias;