summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-01-23 18:48:25 +0100
committerGitHub <noreply@github.com>2023-01-23 18:48:25 +0100
commit0137c3fdae9171b370eae22c67e3ee4784b71f60 (patch)
tree67bec678f66f2d2bb5ff2f637948966478932aec
parent41a99bc819ba35209a6386d08326060f9b53b49e (diff)
parent581b904507eca5bc145de595a7347fcfb80f28b4 (diff)
Merge pull request #25686 from vespa-engine/balder/less-code
Use const ref to reduce code bloat.
-rw-r--r--vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp b/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp
index e865239787b..64e0c1599bd 100644
--- a/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp
+++ b/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp
@@ -5,7 +5,6 @@
#include <vespa/vespalib/test/datastore/buffer_stats.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/test/memory_allocator_observer.h>
-#include <vespa/vespalib/util/traits.h>
#include <vector>
using namespace vespalib::datastore;
@@ -29,12 +28,12 @@ template <typename RefT = EntryRefT<22>>
struct TestBase : public ::testing::Test {
using EntryRefType = RefT;
- AllocStats stats;
+ AllocStats allocStats;
UniqueStoreStringAllocator<EntryRefType> allocator;
generation_t generation;
TestBase()
- : stats(),
- allocator(std::make_unique<MemoryAllocatorObserver>(stats)),
+ : allocStats(),
+ allocator(std::make_unique<MemoryAllocatorObserver>(allocStats)),
generation(1)
{}
void assert_add(const char *input) {
@@ -61,11 +60,12 @@ struct TestBase : public ::testing::Test {
return allocator.get_data_store().getBufferState(get_buffer_id(ref));
}
void assert_buffer_state(EntryRef ref, const TestBufferStats expStats) const {
+ const auto & stats = buffer_state(ref).stats();
EXPECT_EQ(expStats._used, buffer_state(ref).size());
- EXPECT_EQ(expStats._hold, buffer_state(ref).stats().hold_elems());
- EXPECT_EQ(expStats._dead, buffer_state(ref).stats().dead_elems());
- EXPECT_EQ(expStats._extra_used, buffer_state(ref).stats().extra_used_bytes());
- EXPECT_EQ(expStats._extra_hold, buffer_state(ref).stats().extra_hold_bytes());
+ EXPECT_EQ(expStats._hold, stats.hold_elems());
+ EXPECT_EQ(expStats._dead, stats.dead_elems());
+ EXPECT_EQ(expStats._extra_used, stats.extra_used_bytes());
+ EXPECT_EQ(expStats._extra_hold, stats.extra_hold_bytes());
}
void reclaim_memory() {
allocator.get_data_store().assign_generation(generation++);
@@ -179,7 +179,7 @@ TEST_F(StringTest, free_list_is_never_used_for_move_on_compact)
TEST_F(StringTest, provided_memory_allocator_is_used)
{
- EXPECT_EQ(AllocStats(18, 0), stats);
+ EXPECT_EQ(AllocStats(18, 0), allocStats);
}
TEST_F(SmallOffsetStringTest, new_underlying_buffer_is_allocated_when_current_is_full)
@@ -196,7 +196,7 @@ TEST_F(SmallOffsetStringTest, new_underlying_buffer_is_allocated_when_current_is
uint32_t buffer_id = get_buffer_id(add(small.c_str()));
EXPECT_EQ(second_buffer_id, buffer_id);
}
- EXPECT_LT(18, stats.alloc_cnt);
+ EXPECT_LT(18, allocStats.alloc_cnt);
}
GTEST_MAIN_RUN_ALL_TESTS()