mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
test constants
This commit is contained in:
parent
5999c04eb5
commit
14adc795ac
27
net.cpp
27
net.cpp
@ -343,3 +343,30 @@ BOOST_AUTO_TEST_CASE(test_udp_once)
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(netTypes)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(unspecifiedNode)
|
||||
{
|
||||
Node n = UnspecifiedNode;
|
||||
BOOST_REQUIRE(!n);
|
||||
|
||||
Node node(Public(sha3("0")), NodeIPEndpoint(bi::address(), 0, 0));
|
||||
BOOST_REQUIRE(node);
|
||||
BOOST_REQUIRE(n != node);
|
||||
|
||||
Node nodeEq(Public(sha3("0")), NodeIPEndpoint(bi::address(), 0, 0));
|
||||
BOOST_REQUIRE_EQUAL(node, nodeEq);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(nodeTableReturnsUnspecifiedNode)
|
||||
{
|
||||
ba::io_service io;
|
||||
NodeTable t(io, KeyPair::create(), NodeIPEndpoint(bi::address::from_string("127.0.0.1"), 30303, 30303));
|
||||
if (Node n = t.node(NodeId()))
|
||||
BOOST_REQUIRE(false);
|
||||
else
|
||||
BOOST_REQUIRE(n == UnspecifiedNode);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
23
peer.cpp
23
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;
|
||||
|
Loading…
Reference in New Issue
Block a user