summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-10-06 13:15:45 +0200
committerGitHub <noreply@github.com>2023-10-06 13:15:45 +0200
commit57f34d015e3d9fd85a593455e4cd61919ea6bee0 (patch)
tree2699806523e125c135053dfe240fbb1de782ebc7 /searchlib/src/tests
parent178d9d661c4eaebc9803031ec390ff2f9812ad9b (diff)
parent881ee33e47aa8f2f3188e6178c11883f5bec05c8 (diff)
Merge pull request #28812 from vespa-engine/balder/avoid-holding-guard
Balder/avoid holding guard
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/docstore/chunk/chunk_test.cpp14
-rw-r--r--searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp6
-rw-r--r--searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp6
3 files changed, 13 insertions, 13 deletions
diff --git a/searchlib/src/tests/docstore/chunk/chunk_test.cpp b/searchlib/src/tests/docstore/chunk/chunk_test.cpp
index 28bd5208b73..d2e406d7cf4 100644
--- a/searchlib/src/tests/docstore/chunk/chunk_test.cpp
+++ b/searchlib/src/tests/docstore/chunk/chunk_test.cpp
@@ -19,10 +19,10 @@ TEST("require that Chunk obey limits")
{
Chunk c(0, Chunk::Config(256));
EXPECT_TRUE(c.hasRoom(1000)); // At least 1 is allowed no matter what the size is.
- c.append(1, "abc", 3);
+ c.append(1, {"abc", 3});
EXPECT_TRUE(c.hasRoom(229));
EXPECT_FALSE(c.hasRoom(230));
- c.append(2, "abc", 3);
+ c.append(2, {"abc", 3});
EXPECT_TRUE(c.hasRoom(20));
}
@@ -30,11 +30,11 @@ TEST("require that Chunk can produce unique list")
{
const char *d = "ABCDEF";
Chunk c(0, Chunk::Config(100));
- c.append(1, d, 1);
- c.append(2, d, 2);
- c.append(3, d, 3);
- c.append(2, d, 4);
- c.append(1, d, 5);
+ c.append(1, {d, 1});
+ c.append(2, {d, 2});
+ c.append(3, {d, 3});
+ c.append(2, {d, 4});
+ c.append(1, {d, 5});
EXPECT_EQUAL(5u, c.count());
const Chunk::LidList & all = c.getLids();
EXPECT_EQUAL(5u, all.size());
diff --git a/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp b/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp
index 64ae4dfd2f2..a0cb6c881cf 100644
--- a/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp
+++ b/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp
@@ -43,10 +43,10 @@ struct BucketizerObserver : public IBucketizer {
document::BucketId getBucketOf(const vespalib::GenerationHandler::Guard &guard, uint32_t lid) const override {
(void) guard;
lids.push_back(lid);
- return document::BucketId();
+ return {};
}
vespalib::GenerationHandler::Guard getGuard() const override {
- return vespalib::GenerationHandler::Guard();
+ return {};
}
};
@@ -129,7 +129,7 @@ struct WriteFixture : public FixtureBase {
}
WriteFixture &append(uint32_t lid) {
vespalib::string data = getData(lid);
- chunk.append(nextSerialNum(), lid, data.c_str(), data.size(), CpuUsage::Category::WRITE);
+ chunk.append(nextSerialNum(), lid, {data.c_str(), data.size()}, CpuUsage::Category::WRITE);
return *this;
}
void updateLidMap(uint32_t docIdLimit) {
diff --git a/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp b/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp
index c7e0c59da12..053a2806b5d 100644
--- a/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp
+++ b/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp
@@ -35,13 +35,13 @@ add(StoreByBucket & sbb, size_t i) {
EXPECT_EQUAL(userId(i), docId.getGlobalId().getLocationSpecificBits());
b.setUsedBits(USED_BITS);
vespalib::string s = createPayload(b);
- sbb.add(b, i%10, i, s.c_str(), s.size());
+ sbb.add(b, i%10, i, {s.c_str(), s.size()});
}
class VerifyBucketOrder : public StoreByBucket::IWrite {
public:
VerifyBucketOrder() : _lastLid(0), _lastBucketId(0), _uniqueUser(), _uniqueBucket() { }
- void write(BucketId bucketId, uint32_t chunkId, uint32_t lid, const void *buffer, size_t sz) override {
+ void write(BucketId bucketId, uint32_t chunkId, uint32_t lid, vespalib::ConstBufferRef data) override {
(void) chunkId;
EXPECT_LESS_EQUAL(_lastBucketId.toKey(), bucketId.toKey());
if (_lastBucketId != bucketId) {
@@ -54,7 +54,7 @@ public:
}
_lastLid = lid;
_lastBucketId = bucketId;
- EXPECT_EQUAL(0, memcmp(buffer, createPayload(bucketId).c_str(), sz));
+ EXPECT_EQUAL(0, memcmp(data.data(), createPayload(bucketId).c_str(), data.size()));
}
~VerifyBucketOrder() override;
private: