diff --git a/searchlib/src/tests/docstore/file_chunk/CMakeLists.txt b/searchlib/src/tests/docstore/file_chunk/CMakeLists.txt index cae93c150608..744ec21571ea 100644 --- a/searchlib/src/tests/docstore/file_chunk/CMakeLists.txt +++ b/searchlib/src/tests/docstore/file_chunk/CMakeLists.txt @@ -4,5 +4,6 @@ vespa_add_executable(searchlib_file_chunk_test_app TEST file_chunk_test.cpp DEPENDS vespa_searchlib + GTest::gtest ) vespa_add_test(NAME searchlib_file_chunk_test_app COMMAND searchlib_file_chunk_test_app) 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 34a6512b832b..2e7cf3cad03c 100644 --- a/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp +++ b/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp @@ -4,13 +4,12 @@ #include #include #include -#include +#include +#include #include #include #include #include -#include -#include #include @@ -86,10 +85,10 @@ struct FixtureBase { } ~FixtureBase(); void assertLidMap(const std::vector &expLids) const { - EXPECT_EQUAL(expLids, lidObserver.lids); + EXPECT_EQ(expLids, lidObserver.lids); } void assertBucketizer(const std::vector &expLids) const { - EXPECT_EQUAL(expLids, bucketizer.lids); + EXPECT_EQ(expLids, bucketizer.lids); } }; @@ -140,56 +139,56 @@ struct WriteFixture : public FixtureBase { }; -TEST_F("require that idx file without docIdLimit in header can be read by FileChunk", - ReadFixture(TEST_PATH("without_doc_id_limit"), false)) +TEST(FileChunkTest, require_that_idx_file_without_docIdLimit_in_header_can_be_read_by_FileChunk) { - EXPECT_EQUAL(std::numeric_limits::max(), f.chunk.getDocIdLimit()); + ReadFixture f(TEST_PATH("without_doc_id_limit"), false); + EXPECT_EQ(std::numeric_limits::max(), f.chunk.getDocIdLimit()); } -TEST_F("require that idx file without docIdLimit in header can be read by WriteableFileChunk", - WriteFixture(TEST_PATH("without_doc_id_limit"), 1000, false)) +TEST(FileChunkTest, require_that_idx_file_without_docIdLimit_in_header_can_be_read_by_WriteableFileChunk) { - EXPECT_EQUAL(std::numeric_limits::max(), f.chunk.getDocIdLimit()); + WriteFixture f(TEST_PATH("without_doc_id_limit"), 1000, false); + EXPECT_EQ(std::numeric_limits::max(), f.chunk.getDocIdLimit()); } -TEST("require that docIdLimit is written to and read from idx file header") +TEST(FileChunkTest, require_that_docIdLimit_is_written_to_and_read_from_idx_file_header) { { WriteFixture f("tmp", 1000, false); - EXPECT_EQUAL(1000u, f.chunk.getDocIdLimit()); + EXPECT_EQ(1000u, f.chunk.getDocIdLimit()); } { ReadFixture f("tmp", false); f.updateLidMap(std::numeric_limits::max()); // trigger reading of idx file header - EXPECT_EQUAL(1000u, f.chunk.getDocIdLimit()); + EXPECT_EQ(1000u, f.chunk.getDocIdLimit()); } { WriteFixture f("tmp", 0); - EXPECT_EQUAL(1000u, f.chunk.getDocIdLimit()); + EXPECT_EQ(1000u, f.chunk.getDocIdLimit()); } } -TEST("require that numlids are updated") { +TEST(FileChunkTest, require_that_numlids_are_updated) { { WriteFixture f("tmp", 1000, false); f.updateLidMap(1000); - EXPECT_EQUAL(0u, f.chunk.getNumLids()); + EXPECT_EQ(0u, f.chunk.getNumLids()); f.append(1); - EXPECT_EQUAL(1u, f.chunk.getNumLids()); + EXPECT_EQ(1u, f.chunk.getNumLids()); f.append(2); f.append(3); - EXPECT_EQUAL(3u, f.chunk.getNumLids()); + EXPECT_EQ(3u, f.chunk.getNumLids()); f.append(3); - EXPECT_EQUAL(4u, f.chunk.getNumLids()); + EXPECT_EQ(4u, f.chunk.getNumLids()); f.flush(); } { WriteFixture f("tmp", 1000, true); - EXPECT_EQUAL(0u, f.chunk.getNumLids()); + EXPECT_EQ(0u, f.chunk.getNumLids()); f.updateLidMap(1000); - EXPECT_EQUAL(4u, f.chunk.getNumLids()); + EXPECT_EQ(4u, f.chunk.getNumLids()); f.append(7); - EXPECT_EQUAL(5u, f.chunk.getNumLids()); + EXPECT_EQ(5u, f.chunk.getNumLids()); } } @@ -201,12 +200,12 @@ assertUpdateLidMap(FixtureType &f) f.assertLidMap(expLids); f.assertBucketizer(expLids); size_t entrySize = 10 + 8; - EXPECT_EQUAL(9 * entrySize, f.chunk.getAddedBytes()); - EXPECT_EQUAL(3u, f.chunk.getErasedCount()); - EXPECT_EQUAL(3 * entrySize, f.chunk.getErasedBytes()); + EXPECT_EQ(9 * entrySize, f.chunk.getAddedBytes()); + EXPECT_EQ(3u, f.chunk.getErasedCount()); + EXPECT_EQ(3 * entrySize, f.chunk.getErasedBytes()); } -TEST("require that entries with lid >= docIdLimit are skipped in updateLidMap()") +TEST(FileChunkTest, require_that_entries_with_lid_ge__docIdLimit_are_skipped_in_updateLidMap) { { WriteFixture f("tmp", 0, false); @@ -227,7 +226,7 @@ TEST("require that entries with lid >= docIdLimit are skipped in updateLidMap()" using vespalib::compression::CompressionConfig; -TEST("require that operator == detects inequality") { +TEST(FileChunkTest, require_that_operator_eq_detects_inequality) { using C = WriteableFileChunk::Config; EXPECT_TRUE(C() == C()); EXPECT_TRUE(C({}, 1) == C({}, 1)); @@ -236,5 +235,4 @@ TEST("require that operator == detects inequality") { EXPECT_FALSE(C({CompressionConfig::LZ4, 9, 60}, 2) == C({}, 2)); } -TEST_MAIN() { TEST_RUN_ALL(); } - +GTEST_MAIN_RUN_ALL_TESTS()