diff options
Diffstat (limited to 'peer.cpp')
-rw-r--r-- | peer.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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; |