Skip to content

Commit

Permalink
utils/fragmented_vector: Add a test for iterator access
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Pope <ben@redpanda.com>
  • Loading branch information
BenPope committed Oct 2, 2023
1 parent 862e889 commit 239a9f0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/v/utils/tests/fragmented_vector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,23 @@ BOOST_AUTO_TEST_CASE(fragmented_vector_iterator_types) {
decltype(v)::const_iterator>);
}

struct foo {
int a;
friend std::ostream& operator<<(std::ostream& os, foo const& f) {
return os << f.a;
}
friend auto operator<=>(foo const&, foo const&) = default;
};

BOOST_AUTO_TEST_CASE(fragmented_vector_iterator_access) {
using vtype = fragmented_vector<foo, 8>;
auto vec = vtype{};
vec.push_back(foo{2});

BOOST_CHECK_EQUAL(*vec.begin(), foo{2});
BOOST_CHECK_EQUAL((*vec.begin()).a, 2);
}

/**
* Get a fragmented vector for elements of size E, with max_fragment_size F.
*/
Expand Down

0 comments on commit 239a9f0

Please sign in to comment.