Merge branch 'master' into fix-issue-776-support-autoconf-as-submodule

This commit is contained in:
Gennadiy Civil 2017-12-19 13:43:22 -05:00 committed by GitHub
commit b5b6a07d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 7 additions and 115 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2017 Google Inc. # Copyright 2017 Google Inc.
# All Rights Reserved. # All Rights Reserved.
# #
# #
@ -41,7 +41,7 @@ config_setting(
values = {"cpu": "x64_windows_msvc"}, values = {"cpu": "x64_windows_msvc"},
) )
# Google Test including Google Mock # Google Test including Google Mock
cc_library( cc_library(
name = "gtest", name = "gtest",
srcs = glob( srcs = glob(
@ -88,7 +88,7 @@ cc_library(
srcs = [ srcs = [
"googlemock/src/gmock_main.cc", "googlemock/src/gmock_main.cc",
], ],
deps = ["//:gtest"], deps = [":gtest"],
) )
# The following rules build samples of how to use gTest. # The following rules build samples of how to use gTest.

View File

@ -185,15 +185,10 @@ TEST_P(DerivedTest, DoesBlah) {
# include <utility> # include <utility>
#endif #endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-param-util-generated.h" #include "gtest/internal/gtest-param-util-generated.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Functions producing parameter generators. // Functions producing parameter generators.
@ -1439,6 +1434,4 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_

View File

@ -184,15 +184,10 @@ TEST_P(DerivedTest, DoesBlah) {
# include <utility> # include <utility>
#endif #endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-param-util-generated.h" #include "gtest/internal/gtest-param-util-generated.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Functions producing parameter generators. // Functions producing parameter generators.
@ -505,6 +500,4 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_

View File

@ -1180,14 +1180,12 @@ class GTEST_API_ UnitTest {
// Returns the random seed used at the start of the current test run. // Returns the random seed used at the start of the current test run.
int random_seed() const; int random_seed() const;
#if GTEST_HAS_PARAM_TEST
// Returns the ParameterizedTestCaseRegistry object used to keep track of // Returns the ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them. // value-parameterized tests and instantiate and register them.
// //
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
GTEST_LOCK_EXCLUDED_(mutex_); GTEST_LOCK_EXCLUDED_(mutex_);
#endif // GTEST_HAS_PARAM_TEST
// Gets the number of successful test cases. // Gets the number of successful test cases.
int successful_test_case_count() const; int successful_test_case_count() const;
@ -1706,7 +1704,6 @@ class GTEST_API_ AssertHelper {
} // namespace internal } // namespace internal
#if GTEST_HAS_PARAM_TEST
// The pure interface class that all value-parameterized tests inherit from. // The pure interface class that all value-parameterized tests inherit from.
// A value-parameterized class must inherit from both ::testing::Test and // A value-parameterized class must inherit from both ::testing::Test and
// ::testing::WithParamInterface. In most cases that just means inheriting // ::testing::WithParamInterface. In most cases that just means inheriting
@ -1783,7 +1780,6 @@ template <typename T>
class TestWithParam : public Test, public WithParamInterface<T> { class TestWithParam : public Test, public WithParamInterface<T> {
}; };
#endif // GTEST_HAS_PARAM_TEST
// Macros for indicating success/failure in test code. // Macros for indicating success/failure in test code.

View File

@ -46,14 +46,9 @@
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Forward declarations of ValuesIn(), which is implemented in // Forward declarations of ValuesIn(), which is implemented in
@ -5141,6 +5136,4 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_

View File

@ -45,14 +45,9 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Forward declarations of ValuesIn(), which is implemented in // Forward declarations of ValuesIn(), which is implemented in
@ -281,6 +276,4 @@ $for j [[
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_

View File

@ -41,16 +41,11 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-linked_ptr.h" #include "gtest/internal/gtest-linked_ptr.h"
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#include "gtest/gtest-printers.h" #include "gtest/gtest-printers.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Input to a parameterized test name generator, describing a test parameter. // Input to a parameterized test name generator, describing a test parameter.
@ -725,6 +720,4 @@ class ParameterizedTestCaseRegistry {
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_

View File

@ -171,7 +171,6 @@
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized // GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
// tests) // tests)
// GTEST_HAS_DEATH_TEST - death tests // GTEST_HAS_DEATH_TEST - death tests
// GTEST_HAS_PARAM_TEST - value-parameterized tests
// GTEST_HAS_TYPED_TEST - typed tests // GTEST_HAS_TYPED_TEST - typed tests
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests // GTEST_HAS_TYPED_TEST_P - type-parameterized tests
// GTEST_IS_THREADSAFE - Google Test is thread-safe. // GTEST_IS_THREADSAFE - Google Test is thread-safe.
@ -815,11 +814,6 @@ using ::std::tuple_size;
# define GTEST_HAS_DEATH_TEST 1 # define GTEST_HAS_DEATH_TEST 1
#endif #endif
// We don't support MSVC 7.1 with exceptions disabled now. Therefore
// all the compilers we care about are adequate for supporting
// value-parameterized tests.
#define GTEST_HAS_PARAM_TEST 1
// Determines whether to support type-driven tests. // Determines whether to support type-driven tests.
// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0, // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
@ -830,11 +824,10 @@ using ::std::tuple_size;
# define GTEST_HAS_TYPED_TEST_P 1 # define GTEST_HAS_TYPED_TEST_P 1
#endif #endif
// Determines whether to support Combine(). This only makes sense when // Determines whether to support Combine().
// value-parameterized tests are enabled. The implementation doesn't // The implementation doesn't work on Sun Studio since it doesn't
// work on Sun Studio since it doesn't understand templated conversion // understand templated conversion operators.
// operators. #if GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
# define GTEST_HAS_COMBINE 1 # define GTEST_HAS_COMBINE 1
#endif #endif

View File

@ -40,7 +40,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace { namespace {
#if GTEST_HAS_PARAM_TEST
using ::testing::TestWithParam; using ::testing::TestWithParam;
using ::testing::Values; using ::testing::Values;
@ -116,15 +115,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
Values(&CreateOnTheFlyPrimeTable, Values(&CreateOnTheFlyPrimeTable,
&CreatePreCalculatedPrimeTable<1000>)); &CreatePreCalculatedPrimeTable<1000>));
#else
// Google Test may not support value-parameterized tests with some
// compilers. If we use conditional compilation to compile out all
// code referring to the gtest_main library, MSVC linker will not link
// that library at all and consequently complain about missing entry
// point defined in that library (fatal error LNK1561: entry point
// must be defined). This dummy test keeps gtest_main linked in.
TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
#endif // GTEST_HAS_PARAM_TEST
} // namespace } // namespace

View File

@ -664,13 +664,11 @@ class GTEST_API_ UnitTestImpl {
tear_down_tc)->AddTestInfo(test_info); tear_down_tc)->AddTestInfo(test_info);
} }
#if GTEST_HAS_PARAM_TEST
// Returns ParameterizedTestCaseRegistry object used to keep track of // Returns ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them. // value-parameterized tests and instantiate and register them.
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() { internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
return parameterized_test_registry_; return parameterized_test_registry_;
} }
#endif // GTEST_HAS_PARAM_TEST
// Sets the TestCase object for the test that's currently running. // Sets the TestCase object for the test that's currently running.
void set_current_test_case(TestCase* a_current_test_case) { void set_current_test_case(TestCase* a_current_test_case) {
@ -845,14 +843,12 @@ class GTEST_API_ UnitTestImpl {
// shuffled order. // shuffled order.
std::vector<int> test_case_indices_; std::vector<int> test_case_indices_;
#if GTEST_HAS_PARAM_TEST
// ParameterizedTestRegistry object used to register value-parameterized // ParameterizedTestRegistry object used to register value-parameterized
// tests. // tests.
internal::ParameterizedTestCaseRegistry parameterized_test_registry_; internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
// Indicates whether RegisterParameterizedTests() has been called already. // Indicates whether RegisterParameterizedTests() has been called already.
bool parameterized_tests_registered_; bool parameterized_tests_registered_;
#endif // GTEST_HAS_PARAM_TEST
// Index of the last death test case registered. Initially -1. // Index of the last death test case registered. Initially -1.
int last_death_test_case_; int last_death_test_case_;

View File

@ -2556,7 +2556,6 @@ TestInfo* MakeAndRegisterTestInfo(
return test_info; return test_info;
} }
#if GTEST_HAS_PARAM_TEST
void ReportInvalidTestCaseType(const char* test_case_name, void ReportInvalidTestCaseType(const char* test_case_name,
CodeLocation code_location) { CodeLocation code_location) {
Message errors; Message errors;
@ -2575,7 +2574,6 @@ void ReportInvalidTestCaseType(const char* test_case_name,
code_location.line) code_location.line)
<< " " << errors.GetString(); << " " << errors.GetString();
} }
#endif // GTEST_HAS_PARAM_TEST
} // namespace internal } // namespace internal
@ -2614,12 +2612,10 @@ namespace internal {
// and INSTANTIATE_TEST_CASE_P into regular tests and registers those. // and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
// This will be done just once during the program runtime. // This will be done just once during the program runtime.
void UnitTestImpl::RegisterParameterizedTests() { void UnitTestImpl::RegisterParameterizedTests() {
#if GTEST_HAS_PARAM_TEST
if (!parameterized_tests_registered_) { if (!parameterized_tests_registered_) {
parameterized_test_registry_.RegisterTests(); parameterized_test_registry_.RegisterTests();
parameterized_tests_registered_ = true; parameterized_tests_registered_ = true;
} }
#endif
} }
} // namespace internal } // namespace internal
@ -4309,7 +4305,6 @@ const TestInfo* UnitTest::current_test_info() const
// Returns the random seed used at the start of the current test run. // Returns the random seed used at the start of the current test run.
int UnitTest::random_seed() const { return impl_->random_seed(); } int UnitTest::random_seed() const { return impl_->random_seed(); }
#if GTEST_HAS_PARAM_TEST
// Returns ParameterizedTestCaseRegistry object used to keep track of // Returns ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them. // value-parameterized tests and instantiate and register them.
internal::ParameterizedTestCaseRegistry& internal::ParameterizedTestCaseRegistry&
@ -4317,7 +4312,6 @@ internal::ParameterizedTestCaseRegistry&
GTEST_LOCK_EXCLUDED_(mutex_) { GTEST_LOCK_EXCLUDED_(mutex_) {
return impl_->parameterized_test_registry(); return impl_->parameterized_test_registry();
} }
#endif // GTEST_HAS_PARAM_TEST
// Creates an empty UnitTest. // Creates an empty UnitTest.
UnitTest::UnitTest() { UnitTest::UnitTest() {
@ -4356,10 +4350,8 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
&default_global_test_part_result_reporter_), &default_global_test_part_result_reporter_),
per_thread_test_part_result_reporter_( per_thread_test_part_result_reporter_(
&default_per_thread_test_part_result_reporter_), &default_per_thread_test_part_result_reporter_),
#if GTEST_HAS_PARAM_TEST
parameterized_test_registry_(), parameterized_test_registry_(),
parameterized_tests_registered_(false), parameterized_tests_registered_(false),
#endif // GTEST_HAS_PARAM_TEST
last_death_test_case_(-1), last_death_test_case_(-1),
current_test_case_(NULL), current_test_case_(NULL),
current_test_info_(NULL), current_test_info_(NULL),

View File

@ -36,8 +36,6 @@
#include "test/gtest-param-test_test.h" #include "test/gtest-param-test_test.h"
#if GTEST_HAS_PARAM_TEST
using ::testing::Values; using ::testing::Values;
using ::testing::internal::ParamGenerator; using ::testing::internal::ParamGenerator;
@ -61,5 +59,3 @@ INSTANTIATE_TEST_CASE_P(MultiplesOf33,
INSTANTIATE_TEST_CASE_P(Sequence2, INSTANTIATE_TEST_CASE_P(Sequence2,
InstantiationInMultipleTranslaionUnitsTest, InstantiationInMultipleTranslaionUnitsTest,
Values(42*3, 42*4, 42*5)); Values(42*3, 42*4, 42*5));
#endif // GTEST_HAS_PARAM_TEST

View File

@ -35,8 +35,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_PARAM_TEST
# include <algorithm> # include <algorithm>
# include <iostream> # include <iostream>
# include <list> # include <list>
@ -1025,31 +1023,19 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5)); 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) { int main(int argc, char **argv) {
#if GTEST_HAS_PARAM_TEST
// Used in TestGenerationTest test case. // Used in TestGenerationTest test case.
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance()); AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
// Used in GeneratorEvaluationTest test case. Tests that the updated value // Used in GeneratorEvaluationTest test case. Tests that the updated value
// will be picked up for instantiating tests in GeneratorEvaluationTest. // will be picked up for instantiating tests in GeneratorEvaluationTest.
GeneratorEvaluationTest::set_param_value(1); GeneratorEvaluationTest::set_param_value(1);
#endif // GTEST_HAS_PARAM_TEST
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
#if GTEST_HAS_PARAM_TEST
// Used in GeneratorEvaluationTest test case. Tests that value updated // Used in GeneratorEvaluationTest test case. Tests that value updated
// here will NOT be used for instantiating tests in // here will NOT be used for instantiating tests in
// GeneratorEvaluationTest. // GeneratorEvaluationTest.
GeneratorEvaluationTest::set_param_value(2); GeneratorEvaluationTest::set_param_value(2);
#endif // GTEST_HAS_PARAM_TEST
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }

View File

@ -39,8 +39,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_PARAM_TEST
// Test fixture for testing definition and instantiation of a test // Test fixture for testing definition and instantiation of a test
// in separate translation units. // in separate translation units.
class ExternalInstantiationTest : public ::testing::TestWithParam<int> { class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
@ -52,6 +50,4 @@ class InstantiationInMultipleTranslaionUnitsTest
: public ::testing::TestWithParam<int> { : public ::testing::TestWithParam<int> {
}; };
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_

View File

@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) {
FAIL() << "Expected failure."; FAIL() << "Expected failure.";
} }
#if GTEST_HAS_PARAM_TEST
class ParamTest : public testing::TestWithParam<int> { 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(SeqP, ParamTest, testing::Values(1, 2));
INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6)); INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
#endif // GTEST_HAS_PARAM_TEST
} // namespace } // namespace

View File

@ -757,8 +757,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
// This #ifdef block tests the output of value-parameterized tests. // This #ifdef block tests the output of value-parameterized tests.
#if GTEST_HAS_PARAM_TEST
std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) { std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
return info.param; return info.param;
} }
@ -779,8 +777,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings,
testing::Values(std::string("a")), testing::Values(std::string("a")),
ParamNameFunc); ParamNameFunc);
#endif // GTEST_HAS_PARAM_TEST
// This #ifdef block tests the output of typed tests. // This #ifdef block tests the output of typed tests.
#if GTEST_HAS_TYPED_TEST #if GTEST_HAS_TYPED_TEST

View File

@ -119,7 +119,6 @@ TEST(BarDeathTest, ThreadSafeAndFast) {
EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), ""); EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), "");
} }
#if GTEST_HAS_PARAM_TEST
int g_param_test_count = 0; int g_param_test_count = 0;
const int kNumberOfParamTests = 10; const int kNumberOfParamTests = 10;
@ -135,7 +134,6 @@ TEST_P(MyParamTest, ShouldPass) {
INSTANTIATE_TEST_CASE_P(MyParamSequence, INSTANTIATE_TEST_CASE_P(MyParamSequence,
MyParamTest, MyParamTest,
testing::Range(0, kNumberOfParamTests)); testing::Range(0, kNumberOfParamTests));
#endif // GTEST_HAS_PARAM_TEST
// Resets the count for each test. // Resets the count for each test.
void ResetCounts() { void ResetCounts() {
@ -144,9 +142,7 @@ void ResetCounts() {
g_should_fail_count = 0; g_should_fail_count = 0;
g_should_pass_count = 0; g_should_pass_count = 0;
g_death_test_count = 0; g_death_test_count = 0;
#if GTEST_HAS_PARAM_TEST
g_param_test_count = 0; g_param_test_count = 0;
#endif // GTEST_HAS_PARAM_TEST
} }
// Checks that the count for each test is expected. // 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_fail_count);
GTEST_CHECK_INT_EQ_(expected, g_should_pass_count); GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
GTEST_CHECK_INT_EQ_(expected, g_death_test_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); 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. // 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_(0, g_should_fail_count);
GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count); GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
GTEST_CHECK_INT_EQ_(repeat, g_death_test_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); 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 // 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_(repeat, g_should_fail_count);
GTEST_CHECK_INT_EQ_(0, g_should_pass_count); GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
GTEST_CHECK_INT_EQ_(0, g_death_test_count); GTEST_CHECK_INT_EQ_(0, g_death_test_count);
#if GTEST_HAS_PARAM_TEST
GTEST_CHECK_INT_EQ_(0, g_param_test_count); GTEST_CHECK_INT_EQ_(0, g_param_test_count);
#endif // GTEST_HAS_PARAM_TEST
} }
} // namespace } // namespace