This is an automated email from the ASF dual-hosted git repository. bneradt pushed a commit to branch dev-1-1-0 in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git
commit 87a66b2e912392a95c129acd9c7c893e66aeac94 Author: Alan M. Carroll <[email protected]> AuthorDate: Tue Mar 3 09:50:40 2020 -0600 Change IPSpace to return iterator instead of PAYLOAD* --- swoc++/CMakeLists.txt | 3 +- swoc++/include/swoc/ArenaWriter.h | 2 +- swoc++/include/swoc/DiscreteRange.h | 17 +++++---- swoc++/include/swoc/Lexicon.h | 3 +- swoc++/include/swoc/bwf_base.h | 4 +- swoc++/include/swoc/swoc_ip.h | 76 +++++++++++++++++++------------------ swoc++/src/bw_ip_format.cc | 21 ---------- swoc++/src/swoc_ip.cc | 13 ++++--- unit_tests/CMakeLists.txt | 1 + unit_tests/ex_TextView.cc | 2 +- unit_tests/ex_bw_format.cc | 1 - unit_tests/ex_ipspace_properties.cc | 6 ++- unit_tests/test_BufferWriter.cc | 4 +- unit_tests/test_IntrusiveDList.cc | 1 + unit_tests/test_Lexicon.cc | 2 +- unit_tests/test_MemArena.cc | 2 +- unit_tests/test_ip.cc | 61 +++++++++++++++-------------- 17 files changed, 102 insertions(+), 117 deletions(-) diff --git a/swoc++/CMakeLists.txt b/swoc++/CMakeLists.txt index cbe96df..a836c7e 100644 --- a/swoc++/CMakeLists.txt +++ b/swoc++/CMakeLists.txt @@ -45,7 +45,8 @@ set(CC_FILES ) add_library(swoc++ STATIC ${CC_FILES}) -add_compile_options(-Wall -Wextra -Werror -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) +#add_compile_options(-Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) +target_compile_options(swoc++ PRIVATE -Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) # Not quite sure how this works, but I think it generates one of two paths depending on the context. # That is, the generator functions return non-empty strings only in the corresponding context. diff --git a/swoc++/include/swoc/ArenaWriter.h b/swoc++/include/swoc/ArenaWriter.h index 2c41150..a09c573 100644 --- a/swoc++/include/swoc/ArenaWriter.h +++ b/swoc++/include/swoc/ArenaWriter.h @@ -59,6 +59,6 @@ protected: void realloc(size_t n); }; -inline swoc::ArenaWriter::ArenaWriter(swoc::MemArena &arena) : _arena(arena), super_type(arena.remnant()) {} +inline swoc::ArenaWriter::ArenaWriter(swoc::MemArena &arena) : super_type(arena.remnant()), _arena(arena) {} } // namespace swoc diff --git a/swoc++/include/swoc/DiscreteRange.h b/swoc++/include/swoc/DiscreteRange.h index c76f235..967460b 100644 --- a/swoc++/include/swoc/DiscreteRange.h +++ b/swoc++/include/swoc/DiscreteRange.h @@ -594,9 +594,9 @@ protected: using super_type = detail::RBNode; ///< Parent class. friend class DiscreteSpace; - PAYLOAD _payload{}; ///< Default constructor, should zero init if @c PAYLOAD is a pointer. range_type _range; ///< Range covered by this node. range_type _hull; ///< Range covered by subtree rooted at this node. + PAYLOAD _payload{}; ///< Default constructor, should zero init if @c PAYLOAD is a pointer. public: /// Linkage for @c IntrusiveDList. @@ -698,6 +698,7 @@ protected: public: using iterator = typename decltype(_list)::iterator; + using const_iterator = typename decltype(_list)::const_iterator; DiscreteSpace() = default; ~DiscreteSpace(); @@ -756,7 +757,7 @@ public: * @param metric The metric for which to search. * @return The payload for @a metric if found, @c nullptr if not found. */ - PAYLOAD * find(METRIC const &metric); + iterator find(METRIC const &metric); /// @return The number of distinct ranges. size_t count() const; @@ -870,27 +871,27 @@ DiscreteSpace<METRIC, PAYLOAD>::head() -> Node *{ } template <typename METRIC, typename PAYLOAD> -PAYLOAD * -DiscreteSpace<METRIC, PAYLOAD>::find(METRIC const &metric) { +auto +DiscreteSpace<METRIC, PAYLOAD>::find(METRIC const &metric) -> iterator { auto n = _root; // current node to test. while (n) { if (metric < n->min()) { if (n->_hull.contains(metric)) { n = n->left(); } else { - return nullptr; + return this->end(); } } else if (n->max() < metric) { if (n->_hull.contains(metric)) { n = n->right(); } else { - return nullptr; + return this->end(); } } else { - return &n->payload(); + return _list.iterator_for(n); } } - return nullptr; + return this->end(); } template <typename METRIC, typename PAYLOAD> diff --git a/swoc++/include/swoc/Lexicon.h b/swoc++/include/swoc/Lexicon.h index cb782f5..7317f86 100644 --- a/swoc++/include/swoc/Lexicon.h +++ b/swoc++/include/swoc/Lexicon.h @@ -47,8 +47,7 @@ namespace detail std::string what(std::string_view const &fmt, Args &&... args) { std::string zret; - swoc::bwprint_v(zret, fmt, std::forward_as_tuple(args...)); - return std::move(zret); + return swoc::bwprint_v(zret, fmt, std::forward_as_tuple(args...)); } } // namespace detail diff --git a/swoc++/include/swoc/bwf_base.h b/swoc++/include/swoc/bwf_base.h index a8aa874..af894af 100644 --- a/swoc++/include/swoc/bwf_base.h +++ b/swoc++/include/swoc/bwf_base.h @@ -376,7 +376,7 @@ namespace bwf } protected: - Binding(ContextNames const &names, context_type &ctx) : _names(names), _ctx(ctx) {} + Binding(ContextNames const &names, context_type &ctx) : _ctx(ctx), _names(names) {} context_type &_ctx; ///< Context for generators. ContextNames const &_names; ///< Base set of names. @@ -846,7 +846,7 @@ BufferWriter::print_nfv(Binding &&names, Extractor &&ex, bwf::ArgPack const &arg // via the specifier. using spec_type = typename std::remove_reference<decltype(bwf::extractor_spec_type(&std::remove_reference<Extractor>::type::operator()))>::type; - size_t N = args.count(); + int N = args.count(); int arg_idx = 0; // the next argument index to be processed. // Parser is required to return @c false if there's no more data, @c true if something was parsed. diff --git a/swoc++/include/swoc/swoc_ip.h b/swoc++/include/swoc/swoc_ip.h index 4d40e3f..59dce88 100644 --- a/swoc++/include/swoc/swoc_ip.h +++ b/swoc++/include/swoc/swoc_ip.h @@ -1,5 +1,6 @@ #pragma once #pragma once +#pragma once // SPDX-License-Identifier: Apache-2.0 /** @file IP address and network related classes. @@ -522,13 +523,13 @@ public: explicit IPAddr(in_addr_t addr); /// Construct using an IPv4 @a addr - IPAddr(IP4Addr const& addr) : _family(AF_INET), _addr{addr} {} + IPAddr(IP4Addr const& addr) : _addr{addr}, _family(AF_INET) {} /// Construct using IPv6 @a addr. explicit IPAddr(in6_addr const& addr); /// construct using an IPv6 @a addr - IPAddr(IP6Addr const& addr) : _family(AF_INET6), _addr{addr} {} + IPAddr(IP6Addr const& addr) : _addr{addr}, _family(AF_INET6) {} /// Construct from @c sockaddr. explicit IPAddr(sockaddr const *addr); @@ -1438,38 +1439,6 @@ public: return *this; } - /** Find the payload for an @a addr. - * - * @param addr Address to find. - * @return The payload if any, @c nullptr if the address is not in the space. - */ - PAYLOAD *find(IP4Addr const& addr) { - return _ip4.find(addr); - } - - /** Find the payload for an @a addr. - * - * @param addr Address to find. - * @return The payload if any, @c nullptr if the address is not in the space. - */ - PAYLOAD *find(IP6Addr const& addr) { - return _ip6.find(addr); - } - - /** Find the payload for an @a addr. - * - * @param addr Address to find. - * @return The payload if any, @c nullptr if the address is not in the space. - */ - PAYLOAD *find(IPAddr const& addr) { - if (addr.is_ip4()) { - return _ip4.find(IP4Addr{addr}); - } else if (addr.is_ip6()) { - return _ip6.find(IP6Addr{addr}); - } - return nullptr; - } - /// @return The number of distinct ranges. size_t count() const { return _ip4.count() + _ip6.count(); } @@ -1564,7 +1533,7 @@ public: }; /** Iterator. - * THe value type is a tuple of the IP address range and the @a PAYLOAD. The range is constant + * The value type is a tuple of the IP address range and the @a PAYLOAD. The range is constant * and the @a PAYLOAD is a reference. This can be used to update the @a PAYLOAD for this range. * * @note Range merges are not trigged by modifications of the @a PAYLOAD via an iterator. @@ -1631,6 +1600,39 @@ public: using super_type::super_type; /// Inherit supertype constructors. }; + /** Find the payload for an @a addr. + * + * @param addr Address to find. + * @return Iterator for the range containing @a addr. + */ + iterator find(IPAddr const& addr) { + if (addr.is_ip4()) { + return iterator(_ip4.find(IP4Addr{addr}), _ip6.begin()); + } else if (addr.is_ip6()) { + return iterator(_ip4.end(), _ip6.find(IP6Addr{addr})); + } + return this->end(); + } + + /** Find the payload for an @a addr. + * + * @param addr Address to find. + * @return The payload if any, @c nullptr if the address is not in the space. + */ + iterator find(IP4Addr const& addr) { + auto spot = _ip4.find(addr); + return spot == _ip4.end() ? this->end() : iterator{_ip4.find(addr), _ip6.begin()}; + } + + /** Find the payload for an @a addr. + * + * @param addr Address to find. + * @return The payload if any, @c nullptr if the address is not in the space. + */ + iterator find(IP6Addr const& addr) { + return { _ip4.end(), _ip6.find(addr) }; + } + /// @return A constant iterator to the first element. const_iterator begin() const; @@ -1786,9 +1788,9 @@ auto IPSpace<PAYLOAD>::iterator::operator--() -> self_type& { // @c constexpr constructor is required to initialize _something_, it can't be completely uninitializing. inline constexpr IPAddr::raw_addr_type::raw_addr_type() : _ip4(INADDR_ANY) {} -inline IPAddr::IPAddr(in_addr_t addr) : _family(AF_INET), _addr(addr) {} +inline IPAddr::IPAddr(in_addr_t addr) : _addr(addr), _family(AF_INET) {} -inline IPAddr::IPAddr(in6_addr const& addr) : _family(AF_INET6), _addr(addr) {} +inline IPAddr::IPAddr(in6_addr const& addr) : _addr(addr), _family(AF_INET6) {} inline IPAddr::IPAddr(sockaddr const *addr) { this->assign(addr); diff --git a/swoc++/src/bw_ip_format.cc b/swoc++/src/bw_ip_format.cc index 9da2a77..8c8ecdc 100644 --- a/swoc++/src/bw_ip_format.cc +++ b/swoc++/src/bw_ip_format.cc @@ -23,27 +23,6 @@ using namespace swoc::literals; -namespace -{ -std::string_view -family_name(sa_family_t family) -{ - switch (family) { - case AF_INET: - return "ipv4"_sv; - case AF_INET6: - return "ipv6"_sv; - case AF_UNIX: - return "unix"_sv; - case AF_UNSPEC: - return "unspec"_sv; - default: - return "unknown"_sv; - } -} - -} // namespace - namespace swoc { using bwf::Spec; diff --git a/swoc++/src/swoc_ip.cc b/swoc++/src/swoc_ip.cc index 59075a6..f358665 100644 --- a/swoc++/src/swoc_ip.cc +++ b/swoc++/src/swoc_ip.cc @@ -265,7 +265,7 @@ IP4Addr::load(std::string_view const&text) { while (n > 0 && !src.empty()) { TextView token{src.take_prefix_at('.')}; auto x = svto_radix<10>(token); - if (token.empty() && 0 <= x && x <= std::numeric_limits<uint8_t>::max()) { + if (token.empty() && x <= std::numeric_limits<uint8_t>::max()) { octet[--n] = x; } else { break; @@ -372,7 +372,7 @@ IP6Addr::load(std::string_view const&str) { // Sadly the empty quads can't be done in line because it's not possible to know the correct index // of the next present quad until the entire address has been parsed. - while (n < N_QUADS && !src.empty()) { + while (n < static_cast<int>(N_QUADS) && !src.empty()) { TextView token{src.take_prefix_at(':')}; if (token.empty()) { if (empty_idx >= 0) { // two instances of "::", fail. @@ -392,9 +392,9 @@ IP6Addr::load(std::string_view const&str) { // Handle empty quads - invalid if empty and still had a full set of quads if (empty_idx >= 0) { - if (n < N_QUADS) { - auto nil_idx = N_QUADS - (n - empty_idx); - auto delta = N_QUADS - n; + if (n < static_cast<int>(N_QUADS)) { + int nil_idx = N_QUADS - (n - empty_idx); + int delta = N_QUADS - n; for (int k = N_QUADS - 1; k >= empty_idx; --k) { quad[QUAD_IDX[k]] = (k >= nil_idx ? quad[QUAD_IDX[k - delta]] : 0); } @@ -783,7 +783,8 @@ void IP4Range::NetSource::search_wider() { void IP4Range::NetSource::search_narrower() { while (! this->is_valid(_mask)) { - _mask._addr = (_mask._addr >>= 1) | (1<<(IP4Addr::WIDTH-1)); + _mask._addr >>= 1; + _mask._addr |= 1<<(IP4Addr::WIDTH-1); // put top bit back. ++_cidr; } } diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 39de7a7..88f949a 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -28,4 +28,5 @@ add_executable(test_libswoc target_link_libraries(test_libswoc PUBLIC swoc++) set_target_properties(test_libswoc PROPERTIES CLANG_FORMAT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_options(test_libswoc PRIVATE -Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) #add_definitions(-DVERBOSE_EXAMPLE_OUTPUT=1) diff --git a/unit_tests/ex_TextView.cc b/unit_tests/ex_TextView.cc index b6b3b25..a44853f 100644 --- a/unit_tests/ex_TextView.cc +++ b/unit_tests/ex_TextView.cc @@ -282,7 +282,7 @@ TEST_CASE("TextView parsing", "[libswoc][example][text][parsing]") { while (dc_txt) { auto key = dc_txt.take_prefix_at(','); auto value = key.take_suffix_at('='); - auto n = swoc::svtou(value, &parsed); + [[maybe_unused]] auto n = swoc::svtou(value, &parsed); // Each element must be one of the known tags, followed by '=' and an integer. REQUIRE(parsed == value); // value integer. REQUIRE(DC_TAGS.find(key) != DC_TAGS.end()); diff --git a/unit_tests/ex_bw_format.cc b/unit_tests/ex_bw_format.cc index 30bc007..024ef77 100644 --- a/unit_tests/ex_bw_format.cc +++ b/unit_tests/ex_bw_format.cc @@ -229,7 +229,6 @@ TEST_CASE("BufferWriter Context 2", "[bufferwriter][example][context]") // Override the name lookup to handle structured names. class CookieBinding : public swoc::bwf::ContextNames<ExContext const> { - using self_type = CookieBinding; using super_type = swoc::bwf::ContextNames<ExContext const>; public: diff --git a/unit_tests/ex_ipspace_properties.cc b/unit_tests/ex_ipspace_properties.cc index 3420e6a..9cad01a 100644 --- a/unit_tests/ex_ipspace_properties.cc +++ b/unit_tests/ex_ipspace_properties.cc @@ -409,7 +409,8 @@ bool Table::parse(TextView src) { } auto Table::find(IPAddr const &addr) -> Row * { - return _space.find(addr); + auto spot = _space.find(addr); + return spot == _space.end() ? nullptr : &std::get<1>(*spot); } bool operator == (Table::Row const&, Table::Row const&) { return false; } @@ -570,7 +571,7 @@ TEST_CASE("IPSpace properties", "[libswoc][ip][ex][properties]") { auto owner = table.add_column(std::make_unique<EnumProperty>("owner")); auto colo = table.add_column(std::make_unique<EnumProperty>("colo")); auto flags = table.add_column(std::make_unique<FlagGroupProperty>("flags"_tv, flag_names)); - auto description = table.add_column(std::make_unique<StringProperty>("Description")); + [[maybe_unused]] auto description = table.add_column(std::make_unique<StringProperty>("Description")); TextView src = R"(10.1.1.0/24,asf,cmi,prod;internal,"ASF core net" 192.168.28.0/25,asf,ind,prod,"Indy Net" @@ -584,6 +585,7 @@ TEST_CASE("IPSpace properties", "[libswoc][ip][ex][properties]") { CHECK(true == flags->is_set(*row, 0)); CHECK(false == flags->is_set(*row, 1)); CHECK(true == flags->is_set(*row, 2)); + CHECK("asf"_tv == (*owner)(*row)); row = table.find(IPAddr{"192.168.28.131"}); REQUIRE(row != nullptr); diff --git a/unit_tests/test_BufferWriter.cc b/unit_tests/test_BufferWriter.cc index 8b8d0df..6cb4487 100644 --- a/unit_tests/test_BufferWriter.cc +++ b/unit_tests/test_BufferWriter.cc @@ -334,7 +334,7 @@ TEST_CASE("ArenaWriter write", "[BW][ArenaWriter]") swoc::TextView tv = span.view(); try { for (char c = 'a'; c <= 'z'; ++c) { - for (int i = 0; i < buffer.size(); ++i) { + for (size_t i = 0; i < buffer.size(); ++i) { if (c != *tv++) { throw std::exception{}; } @@ -374,7 +374,7 @@ TEST_CASE("ArenaWriter print", "[BW][ArenaWriter]") swoc::TextView tv = span.view(); try { for (char c = 'a'; c <= 'z'; ++c) { - for (int i = 0; i < buffer.size(); ++i) { + for (size_t i = 0; i < buffer.size(); ++i) { if (c != *tv++) { throw std::exception{}; } diff --git a/unit_tests/test_IntrusiveDList.cc b/unit_tests/test_IntrusiveDList.cc index 15f1c43..17b5bfd 100644 --- a/unit_tests/test_IntrusiveDList.cc +++ b/unit_tests/test_IntrusiveDList.cc @@ -98,6 +98,7 @@ TEST_CASE("IntrusiveDList", "[libswoc][IntrusiveDList]") REQUIRE((*spot++)._payload == "muddle"); REQUIRE((*spot++)._payload == "two"); REQUIRE(spot == list.end()); + spot = list.begin(); // verify assignment works. Thing *thing = list.take_head(); REQUIRE(thing->_payload == "one"); diff --git a/unit_tests/test_Lexicon.cc b/unit_tests/test_Lexicon.cc index db4bdde..443763d 100644 --- a/unit_tests/test_Lexicon.cc +++ b/unit_tests/test_Lexicon.cc @@ -75,7 +75,7 @@ TEST_CASE("Lexicon Example", "[libts][Lexicon]") {Radio::DELTA, {"Delta"}}}); // test structured binding for iteration. - for (auto const &[key, name] : lex) { + for ([[maybe_unused]] auto const &[key, name] : lex) { } }; diff --git a/unit_tests/test_MemArena.cc b/unit_tests/test_MemArena.cc index a3d6ace..59774ef 100644 --- a/unit_tests/test_MemArena.cc +++ b/unit_tests/test_MemArena.cc @@ -368,7 +368,7 @@ TEST_CASE("FixedArena", "[libswoc][FixedArena]") { MemArena arena; FixedArena<Thing> fa{arena}; - Thing * one = fa.make(); + [[maybe_unused]] Thing * one = fa.make(); Thing * two = fa.make(); two->x = 17; two->name = "Bob"; diff --git a/unit_tests/test_ip.cc b/unit_tests/test_ip.cc index a088e72..b879ce6 100644 --- a/unit_tests/test_ip.cc +++ b/unit_tests/test_ip.cc @@ -532,17 +532,17 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") { space.mark(IPRange{{IP4Addr("172.16.0.0"), IP4Addr("172.16.0.255")}}, 1); auto result = space.find(IPAddr{"172.16.0.97"}); - REQUIRE(result != nullptr); - REQUIRE(*result == 1); + REQUIRE(result != space.end()); + REQUIRE(std::get<1>(*result) == 1); result = space.find(IPAddr{"172.17.0.97"}); - REQUIRE(result == nullptr); + REQUIRE(result == space.end()); space.mark(IPRange{"172.16.0.12-172.16.0.25"_tv}, 2); result = space.find(IPAddr{"172.16.0.21"}); - REQUIRE(result != nullptr); - REQUIRE(*result == 2); + REQUIRE(result != space.end()); + REQUIRE(std::get<1>(*result) == 2); REQUIRE(space.count() == 3); space.clear(); @@ -550,7 +550,7 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") { lhs |= rhs; return true; }; - unsigned *payload; + swoc::IP4Range r_1{"1.1.1.0-1.1.1.9"}; swoc::IP4Range r_2{"1.1.2.0-1.1.2.97"}; swoc::IP4Range r_3{"1.1.0.0-1.2.0.0"}; @@ -561,35 +561,35 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") { space.blend(r_1, 0x1, BF); REQUIRE(space.count() == 1); - REQUIRE(nullptr == space.find(r_2.min())); - REQUIRE(nullptr != space.find(r_1.min())); - REQUIRE(nullptr != space.find(r_1.max())); - REQUIRE(nullptr != space.find(IP4Addr{"1.1.1.7"})); - CHECK(0x1 == *space.find(IP4Addr{"1.1.1.7"})); + REQUIRE(space.end() == space.find(r_2.min())); + REQUIRE(space.end() != space.find(r_1.min())); + REQUIRE(space.end() != space.find(r_1.max())); + REQUIRE(space.end() != space.find(IP4Addr{"1.1.1.7"})); + CHECK(0x1 == std::get<1>(*space.find(IP4Addr{"1.1.1.7"}))); space.blend(r_2, 0x2, BF); REQUIRE(space.count() == 2); - REQUIRE(nullptr != space.find(r_1.min())); - payload = space.find(r_2.min()); - REQUIRE(payload != nullptr); - REQUIRE(*payload == 0x2); - payload = space.find(r_2.max()); - REQUIRE(payload != nullptr); - REQUIRE(*payload == 0x2); + REQUIRE(space.end() != space.find(r_1.min())); + auto spot = space.find(r_2.min()); + REQUIRE(spot != space.end()); + REQUIRE(std::get<1>(*spot) == 0x2); + spot = space.find(r_2.max()); + REQUIRE(spot != space.end()); + REQUIRE(std::get<1>(*spot) == 0x2); space.blend(r_3, 0x4, BF); REQUIRE(space.count() == 5); - payload = space.find(r_2.min()); - REQUIRE(payload != nullptr); - REQUIRE(*payload == 0x6); + spot = space.find(r_2.min()); + REQUIRE(spot != space.end()); + REQUIRE(std::get<1>(*spot) == 0x6); - payload = space.find(r_3.min()); - REQUIRE(payload != nullptr); - REQUIRE(*payload == 0x4); + spot = space.find(r_3.min()); + REQUIRE(spot != space.end()); + REQUIRE(std::get<1>(*spot) == 0x4); - payload = space.find(r_1.max()); - REQUIRE(payload != nullptr); - REQUIRE(*payload == 0x5); + spot = space.find(r_1.max()); + REQUIRE(spot != space.end()); + REQUIRE(std::get<1>(*spot) == 0x5); space.blend(IPRange{r_2.min(), r_3.max()}, 0x6, BF); REQUIRE(space.count() == 4); @@ -614,9 +614,9 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") { } CHECK(7 == space.count()); - CHECK(nullptr != space.find(IP4Addr{"100.0.4.16"})); - CHECK(nullptr != space.find(IPAddr{"100.0.4.16"})); - CHECK(nullptr != space.find(IPAddr{IPEndpoint{"100.0.4.16:80"}})); + CHECK(space.end() != space.find(IP4Addr{"100.0.4.16"})); + CHECK(space.end() != space.find(IPAddr{"100.0.4.16"})); + CHECK(space.end() != space.find(IPAddr{IPEndpoint{"100.0.4.16:80"}})); } TEST_CASE("IPSpace bitset", "[libswoc][ipspace][bitset]") { @@ -686,7 +686,6 @@ TEST_CASE("IPSpace docJJ", "[libswoc][ipspace][docJJ]") { Space space; for (auto && [text, bit_list] : ranges) { - std::cout << W().print("{} = {}\n", text, bit_list); space.blend(IPRange{text}, bit_list, blender); }
