remove GTEST_HAS_PARAM_TESTS
As mentioned in issue #360: "Now that all the platforms gtest supports work with value-parameterized tests, we should remove the uses of the GTEST_HAS_PARAM_TESTS macro from the codebase everywhere." https://github.com/google/googletest/issues/360
This commit is contained in:
@@ -36,8 +36,6 @@
|
||||
|
||||
#include "test/gtest-param-test_test.h"
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
using ::testing::Values;
|
||||
using ::testing::internal::ParamGenerator;
|
||||
|
||||
@@ -61,5 +59,3 @@ INSTANTIATE_TEST_CASE_P(MultiplesOf33,
|
||||
INSTANTIATE_TEST_CASE_P(Sequence2,
|
||||
InstantiationInMultipleTranslaionUnitsTest,
|
||||
Values(42*3, 42*4, 42*5));
|
||||
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
# include <algorithm>
|
||||
# include <iostream>
|
||||
# include <list>
|
||||
@@ -1025,31 +1023,19 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
|
||||
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {
|
||||
#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST
|
||||
FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n"
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Used in TestGenerationTest test case.
|
||||
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
|
||||
// Used in GeneratorEvaluationTest test case. Tests that the updated value
|
||||
// will be picked up for instantiating tests in GeneratorEvaluationTest.
|
||||
GeneratorEvaluationTest::set_param_value(1);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Used in GeneratorEvaluationTest test case. Tests that value updated
|
||||
// here will NOT be used for instantiating tests in
|
||||
// GeneratorEvaluationTest.
|
||||
GeneratorEvaluationTest::set_param_value(2);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
// Test fixture for testing definition and instantiation of a test
|
||||
// in separate translation units.
|
||||
class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
|
||||
@@ -52,6 +50,4 @@ class InstantiationInMultipleTranslaionUnitsTest
|
||||
: public ::testing::TestWithParam<int> {
|
||||
};
|
||||
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
#endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
|
||||
|
||||
@@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) {
|
||||
FAIL() << "Expected failure.";
|
||||
}
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
class ParamTest : public testing::TestWithParam<int> {
|
||||
};
|
||||
|
||||
@@ -129,7 +128,6 @@ TEST_P(ParamTest, TestY) {
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
|
||||
INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -757,8 +757,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
|
||||
|
||||
// This #ifdef block tests the output of value-parameterized tests.
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
|
||||
return info.param;
|
||||
}
|
||||
@@ -779,8 +777,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings,
|
||||
testing::Values(std::string("a")),
|
||||
ParamNameFunc);
|
||||
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
// This #ifdef block tests the output of typed tests.
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ TEST(BarDeathTest, ThreadSafeAndFast) {
|
||||
EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), "");
|
||||
}
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
int g_param_test_count = 0;
|
||||
|
||||
const int kNumberOfParamTests = 10;
|
||||
@@ -135,7 +134,6 @@ TEST_P(MyParamTest, ShouldPass) {
|
||||
INSTANTIATE_TEST_CASE_P(MyParamSequence,
|
||||
MyParamTest,
|
||||
testing::Range(0, kNumberOfParamTests));
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
// Resets the count for each test.
|
||||
void ResetCounts() {
|
||||
@@ -144,9 +142,7 @@ void ResetCounts() {
|
||||
g_should_fail_count = 0;
|
||||
g_should_pass_count = 0;
|
||||
g_death_test_count = 0;
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
g_param_test_count = 0;
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
|
||||
// Checks that the count for each test is expected.
|
||||
@@ -156,9 +152,7 @@ void CheckCounts(int expected) {
|
||||
GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);
|
||||
GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
|
||||
GTEST_CHECK_INT_EQ_(expected, g_death_test_count);
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
|
||||
// Tests the behavior of Google Test when --gtest_repeat is not specified.
|
||||
@@ -201,9 +195,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) {
|
||||
GTEST_CHECK_INT_EQ_(0, g_should_fail_count);
|
||||
GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
|
||||
GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
|
||||
// Tests using --gtest_repeat when --gtest_filter specifies a set of
|
||||
@@ -219,9 +211,7 @@ void TestRepeatWithFilterForFailedTests(int repeat) {
|
||||
GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);
|
||||
GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
|
||||
GTEST_CHECK_INT_EQ_(0, g_death_test_count);
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
GTEST_CHECK_INT_EQ_(0, g_param_test_count);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user