diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2019-01-09 16:41:37 -0800 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2019-01-13 22:50:36 -0800 |
commit | d6b076c17bc7d513243711563b262524ef0ba74c (patch) | |
tree | 0313896bea97550b6afe38e35f3fd657333ff550 /src/test | |
parent | 0ed279cb4e4198e20a552c279c09134626bbb0bd (diff) |
Drop IsLimited in favor of IsReachable
These two methods have had the same meaning, but inverted, since
110b62f06992d0fb989153afff2dc3aea62a674f. Having one name for a single
concept simplifies the code.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/net_tests.cpp | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp index 4dc394b86d..b4ae8e9765 100644 --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -230,26 +230,21 @@ BOOST_AUTO_TEST_CASE(ipv4_peer_with_ipv6_addrMe_test) BOOST_AUTO_TEST_CASE(LimitedAndReachable_Network) { - SetLimited(NET_IPV4, true); - SetLimited(NET_IPV6, true); - SetLimited(NET_ONION, true); + BOOST_CHECK_EQUAL(IsReachable(NET_IPV4), true); + BOOST_CHECK_EQUAL(IsReachable(NET_IPV6), true); + BOOST_CHECK_EQUAL(IsReachable(NET_ONION), true); - BOOST_CHECK_EQUAL(IsLimited(NET_IPV4), true); - BOOST_CHECK_EQUAL(IsLimited(NET_IPV6), true); - BOOST_CHECK_EQUAL(IsLimited(NET_ONION), true); + SetReachable(NET_IPV4, false); + SetReachable(NET_IPV6, false); + SetReachable(NET_ONION, false); BOOST_CHECK_EQUAL(IsReachable(NET_IPV4), false); BOOST_CHECK_EQUAL(IsReachable(NET_IPV6), false); BOOST_CHECK_EQUAL(IsReachable(NET_ONION), false); - - SetLimited(NET_IPV4, false); - SetLimited(NET_IPV6, false); - SetLimited(NET_ONION, false); - - BOOST_CHECK_EQUAL(IsLimited(NET_IPV4), false); - BOOST_CHECK_EQUAL(IsLimited(NET_IPV6), false); - BOOST_CHECK_EQUAL(IsLimited(NET_ONION), false); + SetReachable(NET_IPV4, true); + SetReachable(NET_IPV6, true); + SetReachable(NET_ONION, true); BOOST_CHECK_EQUAL(IsReachable(NET_IPV4), true); BOOST_CHECK_EQUAL(IsReachable(NET_IPV6), true); @@ -258,19 +253,13 @@ BOOST_AUTO_TEST_CASE(LimitedAndReachable_Network) BOOST_AUTO_TEST_CASE(LimitedAndReachable_NetworkCaseUnroutableAndInternal) { - BOOST_CHECK_EQUAL(IsLimited(NET_UNROUTABLE), false); - BOOST_CHECK_EQUAL(IsLimited(NET_INTERNAL), false); - BOOST_CHECK_EQUAL(IsReachable(NET_UNROUTABLE), true); BOOST_CHECK_EQUAL(IsReachable(NET_INTERNAL), true); - SetLimited(NET_UNROUTABLE, true); - SetLimited(NET_INTERNAL, true); + SetReachable(NET_UNROUTABLE, false); + SetReachable(NET_INTERNAL, false); - BOOST_CHECK_EQUAL(IsLimited(NET_UNROUTABLE), false); // Ignored for both networks - BOOST_CHECK_EQUAL(IsLimited(NET_INTERNAL), false); - - BOOST_CHECK_EQUAL(IsReachable(NET_UNROUTABLE), true); + BOOST_CHECK_EQUAL(IsReachable(NET_UNROUTABLE), true); // Ignored for both networks BOOST_CHECK_EQUAL(IsReachable(NET_INTERNAL), true); } @@ -289,15 +278,13 @@ BOOST_AUTO_TEST_CASE(LimitedAndReachable_CNetAddr) { CNetAddr addr = UtilBuildAddress(0x001, 0x001, 0x001, 0x001); // 1.1.1.1 - SetLimited(NET_IPV4, false); - BOOST_CHECK_EQUAL(IsLimited(addr), false); + SetReachable(NET_IPV4, true); BOOST_CHECK_EQUAL(IsReachable(addr), true); - SetLimited(NET_IPV4, true); - BOOST_CHECK_EQUAL(IsLimited(addr), true); + SetReachable(NET_IPV4, false); BOOST_CHECK_EQUAL(IsReachable(addr), false); - SetLimited(NET_IPV4, false); // have to reset this, because this is stateful. + SetReachable(NET_IPV4, true); // have to reset this, because this is stateful. } @@ -305,7 +292,7 @@ BOOST_AUTO_TEST_CASE(LocalAddress_BasicLifecycle) { CService addr = CService(UtilBuildAddress(0x002, 0x001, 0x001, 0x001), 1000); // 2.1.1.1:1000 - SetLimited(NET_IPV4, false); + SetReachable(NET_IPV4, true); BOOST_CHECK_EQUAL(IsLocal(addr), false); BOOST_CHECK_EQUAL(AddLocal(addr, 1000), true); |