diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-06-25 10:47:34 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-09-16 16:50:19 +0200 |
commit | e2b8028e4c60708a8d49b17d9d49dda10aaecc51 (patch) | |
tree | 2b8bcb0c6f61d3fef5f957306be35672dfbb3946 /src/test/netbase_tests.cpp | |
parent | 9e521c173586257f57764b479beb5923c33ed0eb (diff) |
net: Fix CIDR notation in ToString()
Only use CIDR notation if the netmask can be represented as such.
Diffstat (limited to 'src/test/netbase_tests.cpp')
-rw-r--r-- | src/test/netbase_tests.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index f0333d8687..8e853cc288 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -229,6 +229,12 @@ BOOST_AUTO_TEST_CASE(subnet_test) BOOST_CHECK_EQUAL(subnet.ToString(), "1::/16"); subnet = CSubNet("1:2:3:4:5:6:7:8/0000:0000:0000:0000:0000:0000:0000:0000"); BOOST_CHECK_EQUAL(subnet.ToString(), "::/0"); + subnet = CSubNet("1.2.3.4/255.255.232.0"); + BOOST_CHECK_EQUAL(subnet.ToString(), "1.2.0.0/255.255.232.0"); + subnet = CSubNet("1:2:3:4:5:6:7:8/ffff:ffff:ffff:fffe:ffff:ffff:ffff:ff0f"); + BOOST_CHECK_EQUAL(subnet.ToString(), "1:2:3:4:5:6:7:8/ffff:ffff:ffff:fffe:ffff:ffff:ffff:ff0f"); + subnet = CSubNet("1:2:3:4:5:6:7:8/fff:ffff:ffff:ffff:ffff:ffff:ffff:fff0"); + BOOST_CHECK_EQUAL(subnet.ToString(), "1:2:3:4:5:6:7:0/fff:ffff:ffff:ffff:ffff:ffff:ffff:fff0"); } BOOST_AUTO_TEST_CASE(netbase_getgroup) |