aboutsummaryrefslogtreecommitdiff
path: root/src/test/netbase_tests.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-07-02 21:12:44 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-07-02 21:33:09 +0200
commit66e546577315750ea36eeb26d96842cb768b4315 (patch)
tree27ca8e971b7f86ba7f8bd99cdd3b44b69d2c470e /src/test/netbase_tests.cpp
parent3f16971442f1b52f94759b15998bc82e82a90aea (diff)
parent177a0e491449b9accfa0cf17c138147539071358 (diff)
Merge pull request #6310
177a0e4 Adding CSubNet constructor over a single CNetAddr (Jonas Schnelli) 409bccf use CBanEntry as object container for banned nodes (Jonas Schnelli) dfa174c CAddrDB/CBanDB: change filesize variables from int to uint64_t (Jonas Schnelli) f581d3d banlist.dat: store banlist on disk (Jonas Schnelli)
Diffstat (limited to 'src/test/netbase_tests.cpp')
-rw-r--r--src/test/netbase_tests.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp
index 0f5e1615c6..7154476c7c 100644
--- a/src/test/netbase_tests.cpp
+++ b/src/test/netbase_tests.cpp
@@ -143,6 +143,17 @@ BOOST_AUTO_TEST_CASE(subnet_test)
BOOST_CHECK(CSubNet("1:2:3:4:5:6:7:8/128").IsValid());
BOOST_CHECK(!CSubNet("1:2:3:4:5:6:7:8/129").IsValid());
BOOST_CHECK(!CSubNet("fuzzy").IsValid());
+
+ //CNetAddr constructor test
+ BOOST_CHECK(CSubNet(CNetAddr("127.0.0.1")).IsValid());
+ BOOST_CHECK(CSubNet(CNetAddr("127.0.0.1")).Match(CNetAddr("127.0.0.1")));
+ BOOST_CHECK(!CSubNet(CNetAddr("127.0.0.1")).Match(CNetAddr("127.0.0.2")));
+ BOOST_CHECK(CSubNet(CNetAddr("127.0.0.1")).ToString() == "127.0.0.1/255.255.255.255");
+
+ BOOST_CHECK(CSubNet(CNetAddr("1:2:3:4:5:6:7:8")).IsValid());
+ BOOST_CHECK(CSubNet(CNetAddr("1:2:3:4:5:6:7:8")).Match(CNetAddr("1:2:3:4:5:6:7:8")));
+ BOOST_CHECK(!CSubNet(CNetAddr("1:2:3:4:5:6:7:8")).Match(CNetAddr("1:2:3:4:5:6:7:9")));
+ BOOST_CHECK(CSubNet(CNetAddr("1:2:3:4:5:6:7:8")).ToString() == "1:2:3:4:5:6:7:8/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff");
}
BOOST_AUTO_TEST_SUITE_END()