summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-03-30 10:46:04 +0200
committerTor Egge <Tor.Egge@broadpark.no>2020-03-30 10:46:04 +0200
commiteea2cb29dba9c3214eedb64381f665ae5174b04d (patch)
treecd4fd9f1a145da006221827b5a53b75caf01116b /vespalib
parent463b515efa427bb031e6b83047050084f94008a4 (diff)
Reduce code duplication in test code.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/datastore/unique_store/unique_store_test.cpp6
-rw-r--r--vespalib/src/vespa/vespalib/gtest/gtest.h12
2 files changed, 13 insertions, 5 deletions
diff --git a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp
index f828b4a52e9..e4631e28625 100644
--- a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp
+++ b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp
@@ -159,11 +159,7 @@ template <>
std::vector<double> TestBase<DoubleUniqueStore>::values{ 10.0, 20.0, 30.0, 10.0 };
using UniqueStoreTestTypes = ::testing::Types<NumberUniqueStore, StringUniqueStore, CStringUniqueStore, DoubleUniqueStore>;
-#ifdef TYPED_TEST_SUITE
-TYPED_TEST_SUITE(TestBase, UniqueStoreTestTypes);
-#else
-TYPED_TEST_CASE(TestBase, UniqueStoreTestTypes);
-#endif
+VESPA_GTEST_TYPED_TEST_SUITE(TestBase, UniqueStoreTestTypes);
// Disable warnings emitted by gtest generated files when using typed tests
#pragma GCC diagnostic push
diff --git a/vespalib/src/vespa/vespalib/gtest/gtest.h b/vespalib/src/vespa/vespalib/gtest/gtest.h
index e5bfcf2ae55..87362687103 100644
--- a/vespalib/src/vespa/vespalib/gtest/gtest.h
+++ b/vespalib/src/vespa/vespalib/gtest/gtest.h
@@ -14,3 +14,15 @@ main(int argc, char* argv[]) \
::testing::InitGoogleTest(&argc, argv); \
return RUN_ALL_TESTS(); \
}
+
+#ifdef INSTANTIATE_TEST_SUITE_P
+#define VESPA_GTEST_INSTANTIATE_TEST_SUITE_P INSTANTIATE_TEST_SUITE_P
+#else
+#define VESPA_GTEST_INSTANTIATE_TEST_SUITE_P INSTANTIATE_TEST_CASE_P
+#endif
+
+#ifdef TYPED_TEST_SUITE
+#define VESPA_GTEST_TYPED_TEST_SUITE TYPED_TEST_SUITE
+#else
+#define VESPA_GTEST_TYPED_TEST_SUITE TYPED_TEST_CASE
+#endif