aboutsummaryrefslogtreecommitdiffstats
path: root/net.cpp
diff options
context:
space:
mode:
authorsubtly <subtly@users.noreply.github.com>2015-04-17 08:53:12 +0800
committersubtly <subtly@users.noreply.github.com>2015-04-17 08:53:12 +0800
commit14adc795ac6efc48de5f63cd9b459ee96e968795 (patch)
tree6ae139fbfd23c16d4aa4b0f094b2861614fc28ba /net.cpp
parent5999c04eb5b2ae0f4f7a34b6173a49ad00c89813 (diff)
downloaddexon-solidity-14adc795ac6efc48de5f63cd9b459ee96e968795.tar
dexon-solidity-14adc795ac6efc48de5f63cd9b459ee96e968795.tar.gz
dexon-solidity-14adc795ac6efc48de5f63cd9b459ee96e968795.tar.bz2
dexon-solidity-14adc795ac6efc48de5f63cd9b459ee96e968795.tar.lz
dexon-solidity-14adc795ac6efc48de5f63cd9b459ee96e968795.tar.xz
dexon-solidity-14adc795ac6efc48de5f63cd9b459ee96e968795.tar.zst
dexon-solidity-14adc795ac6efc48de5f63cd9b459ee96e968795.zip
test constants
Diffstat (limited to 'net.cpp')
-rw-r--r--net.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/net.cpp b/net.cpp
index ae605379..fff3c182 100644
--- a/net.cpp
+++ b/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()
+