diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-03-28 23:33:03 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-03-29 17:56:55 +0200 |
commit | 463b515efa427bb031e6b83047050084f94008a4 (patch) | |
tree | eace270f599ab41f93ff5db6ae60a138ef68da75 | |
parent | 49bbb07870e221e6c38b2b7955985c5f3f5518ed (diff) |
Handle newer gtest versions where the legacy API is deprecated.
7 files changed, 41 insertions, 1 deletions
diff --git a/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp b/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp index 31af5945337..3ea2ce73700 100644 --- a/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp @@ -221,7 +221,11 @@ TEST_P(IntegerCompactionTest, compact) test_enum_store_compaction(); } +#ifdef INSTANTIATE_TEST_SUITE_P +INSTANTIATE_TEST_SUITE_P(IntegerCompactionTestSet, IntegerCompactionTest, ::testing::Values(CollectionType::SINGLE, CollectionType::ARRAY, CollectionType::WSET)); +#else INSTANTIATE_TEST_CASE_P(IntegerCompactionTestSet, IntegerCompactionTest, ::testing::Values(CollectionType::SINGLE, CollectionType::ARRAY, CollectionType::WSET)); +#endif using StringCompactionTest = CompactionTest<StringAttribute>; @@ -230,6 +234,10 @@ TEST_P(StringCompactionTest, compact) test_enum_store_compaction(); } +#ifdef INSTANTIATE_TEST_SUITE_P +INSTANTIATE_TEST_SUITE_P(StringCompactionTestSet, StringCompactionTest, ::testing::Values(CollectionType::SINGLE, CollectionType::ARRAY, CollectionType::WSET)); +#else INSTANTIATE_TEST_CASE_P(StringCompactionTestSet, StringCompactionTest, ::testing::Values(CollectionType::SINGLE, CollectionType::ARRAY, CollectionType::WSET)); +#endif GTEST_MAIN_RUN_ALL_TESTS() diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index 3a885dda233..bec6896d4d7 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -72,7 +72,11 @@ public: #endif using FloatEnumStoreTestTypes = ::testing::Types<FloatEnumStore, DoubleEnumStore>; +#ifdef TYPED_TEST_SUITE +TYPED_TEST_SUITE(FloatEnumStoreTest, FloatEnumStoreTestTypes); +#else TYPED_TEST_CASE(FloatEnumStoreTest, FloatEnumStoreTestTypes); +#endif TYPED_TEST(FloatEnumStoreTest, numbers_can_be_inserted_and_retrieved) { @@ -452,7 +456,11 @@ LoaderTest<StringEnumStore>::load_values(enumstore::EnumeratedLoaderBase& loader #endif using LoaderTestTypes = ::testing::Types<NumericEnumStore, FloatEnumStore, StringEnumStore>; +#ifdef TYPED_TEST_SUITE +TYPED_TEST_SUITE(LoaderTest, LoaderTestTypes); +#else TYPED_TEST_CASE(LoaderTest, LoaderTestTypes); +#endif TYPED_TEST(LoaderTest, store_is_instantiated_with_enumerated_loader) { diff --git a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp index c562c0cf29c..c44fffc1d48 100644 --- a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp +++ b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp @@ -517,7 +517,11 @@ struct FieldIndexTest : public ::testing::Test { }; using FieldIndexTestTypes = ::testing::Types<FieldIndex<false>, FieldIndex<true>>; +#ifdef TYPED_TEST_SUITE +TYPED_TEST_SUITE(FieldIndexTest, FieldIndexTestTypes); +#else TYPED_TEST_CASE(FieldIndexTest, FieldIndexTestTypes); +#endif // Disable warnings emitted by gtest generated files when using typed tests #pragma GCC diagnostic push diff --git a/storage/src/tests/distributor/btree_bucket_database_test.cpp b/storage/src/tests/distributor/btree_bucket_database_test.cpp index 43d74ca2fb5..fedea4d7acb 100644 --- a/storage/src/tests/distributor/btree_bucket_database_test.cpp +++ b/storage/src/tests/distributor/btree_bucket_database_test.cpp @@ -9,8 +9,13 @@ using namespace ::testing; namespace storage::distributor { +#ifdef INSTANTIATE_TEST_SUITE_P +INSTANTIATE_TEST_SUITE_P(BTreeDatabase, BucketDatabaseTest, + ::testing::Values(std::make_shared<BTreeBucketDatabase>())); +#else INSTANTIATE_TEST_CASE_P(BTreeDatabase, BucketDatabaseTest, ::testing::Values(std::make_shared<BTreeBucketDatabase>())); +#endif using document::BucketId; diff --git a/storage/src/tests/distributor/mapbucketdatabasetest.cpp b/storage/src/tests/distributor/mapbucketdatabasetest.cpp index 0ae4a49530e..609db4de696 100644 --- a/storage/src/tests/distributor/mapbucketdatabasetest.cpp +++ b/storage/src/tests/distributor/mapbucketdatabasetest.cpp @@ -5,7 +5,12 @@ namespace storage::distributor { +#ifdef INSTANTIATE_TEST_SUITE_P +INSTANTIATE_TEST_SUITE_P(MapDatabase, BucketDatabaseTest, + ::testing::Values(std::make_shared<MapBucketDatabase>())); +#else INSTANTIATE_TEST_CASE_P(MapDatabase, BucketDatabaseTest, ::testing::Values(std::make_shared<MapBucketDatabase>())); +#endif } diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp index 2e5eb115844..ba7c2a9a7c3 100644 --- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp +++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp @@ -105,11 +105,17 @@ std::string version_as_gtest_string(TestParamInfo<vespalib::Version> info) { } -// TODO replace with INSTANTIATE_TEST_SUITE_P on newer gtest versions +#ifdef INSTANTIATE_TEST_SUITE_P +INSTANTIATE_TEST_SUITE_P(MultiVersionTest, StorageProtocolTest, + Values(vespalib::Version(6, 240, 0), + vespalib::Version(7, 41, 19)), + version_as_gtest_string); +#else INSTANTIATE_TEST_CASE_P(MultiVersionTest, StorageProtocolTest, Values(vespalib::Version(6, 240, 0), vespalib::Version(7, 41, 19)), version_as_gtest_string); +#endif namespace { mbus::Message::UP lastCommand; 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 88a5a05738b..f828b4a52e9 100644 --- a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp +++ b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp @@ -159,7 +159,11 @@ 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 // Disable warnings emitted by gtest generated files when using typed tests #pragma GCC diagnostic push |