aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-03-08 20:45:32 +0100
committerGitHub <noreply@github.com>2024-03-08 20:45:32 +0100
commitc5dfea53336083c4d58c7663fb1a96ce00a8be7e (patch)
tree2eb6a5addd8ed37f86027db7f162fd0f361d51e1
parentca03918bb95c71befe9a47986bd6f686d0d6efd3 (diff)
parente4ccdc360ea1f3a0da09a1d207d621755019aebc (diff)
Merge pull request #30533 from vespa-engine/toregge/rewrite-ptr-holder-unit-test-to-gtest
Rewrite PtrHolder unit test to gtest.
-rw-r--r--vespalib/src/tests/sharedptr/CMakeLists.txt1
-rw-r--r--vespalib/src/tests/sharedptr/ptrholder.cpp29
2 files changed, 5 insertions, 25 deletions
diff --git a/vespalib/src/tests/sharedptr/CMakeLists.txt b/vespalib/src/tests/sharedptr/CMakeLists.txt
index 052efb19447..6e038ed31c5 100644
--- a/vespalib/src/tests/sharedptr/CMakeLists.txt
+++ b/vespalib/src/tests/sharedptr/CMakeLists.txt
@@ -4,5 +4,6 @@ vespa_add_executable(vespalib_ptrholder_test_app TEST
ptrholder.cpp
DEPENDS
vespalib
+ GTest::gtest
)
vespa_add_test(NAME vespalib_ptrholder_test_app COMMAND vespalib_ptrholder_test_app)
diff --git a/vespalib/src/tests/sharedptr/ptrholder.cpp b/vespalib/src/tests/sharedptr/ptrholder.cpp
index 8dc3bba2722..e6d1710247b 100644
--- a/vespalib/src/tests/sharedptr/ptrholder.cpp
+++ b/vespalib/src/tests/sharedptr/ptrholder.cpp
@@ -1,20 +1,11 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/util/ptrholder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/gtest/gtest.h>
using vespalib::PtrHolder;
-class Test : public vespalib::TestApp
-{
-public:
- void testEmpty();
- void testSimple();
- int Main() override;
-};
-
-
struct Data
{
int ctorCnt;
@@ -39,8 +30,7 @@ using PT = std::shared_ptr<DataRef>;
using HOLD = PtrHolder<DataRef>;
-void
-Test::testEmpty()
+TEST(PtrHolderTest, test_empty)
{
HOLD hold;
EXPECT_TRUE(hold.get().get() == NULL);
@@ -56,8 +46,7 @@ Test::testEmpty()
}
-void
-Test::testSimple()
+TEST(PtrHolderTest, test_simple)
{
Data data;
HOLD hold;
@@ -86,14 +75,4 @@ Test::testSimple()
EXPECT_TRUE(data.dtorCnt == 2);
}
-
-int
-Test::Main()
-{
- TEST_INIT("ptrholder_test");
- testEmpty();
- testSimple();
- TEST_DONE();
-}
-
-TEST_APPHOOK(Test)
+GTEST_MAIN_RUN_ALL_TESTS()