- 3.0.1 core module.
googletest-param-test-test.cc File Reference
#include "gtest/gtest.h"
#include <algorithm>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <vector>
#include "src/gtest-internal-inl.h"
#include "test/googletest-param-test-test.h"

Classes

class  DogAdder
 
class  IntWrapper
 
class  NonDefaultConstructAssignString
 
class  TestGenerationEnvironment< kExpectedCalls >
 
class  TestGenerationTest
 
class  GeneratorEvaluationTest
 
class  ExternalGeneratorTest
 
class  MultipleInstantiationTest
 
class  SeparateInstanceTest
 
class  NamingTest
 
class  MacroNamingTest
 
class  MacroNamingTestNonParametrized
 
class  CustomFunctorNamingTest
 
struct  CustomParamNameFunctor
 
class  CustomFunctionNamingTest
 
class  CustomLambdaNamingTest
 
class  CustomIntegerNamingTest
 
struct  CustomStruct
 
class  CustomStructNamingTest
 
struct  StatefulNamingFunctor
 
class  StatefulNamingTest
 
class  Unstreamable
 
class  CommentTest
 
class  NonParameterizedBaseTest
 
class  ParameterizedDerivedTest
 
class  ParameterizedDeathTest
 
class  MyEnumTest
 

Macros

#define PREFIX_WITH_FOO(test_name)   Foo##test_name
 
#define PREFIX_WITH_MACRO(test_name)   Macro##test_name
 

Enumerations

Functions

template<typename T >
::std::string PrintValue (const T &value)
 
template<typename T , size_t N>
void VerifyGenerator (const ParamGenerator< T > &generator, const T(&expected_values)[N])
 
template<typename T >
void VerifyGeneratorIsEmpty (const ParamGenerator< T > &generator)
 
 TEST (IteratorTest, ParamIteratorConformsToForwardIteratorConcept)
 
 TEST (RangeTest, IntRangeWithDefaultStep)
 
 TEST (RangeTest, IntRangeSingleValue)
 
 TEST (RangeTest, IntRangeEmpty)
 
 TEST (RangeTest, IntRangeWithCustomStep)
 
 TEST (RangeTest, IntRangeWithCustomStepOverUpperBound)
 
 TEST (RangeTest, WorksWithACustomType)
 
 TEST (RangeTest, WorksWithACustomTypeWithDifferentIncrementType)
 
 TEST (ValuesInTest, ValuesInArray)
 
 TEST (ValuesInTest, ValuesInConstArray)
 
 TEST (ValuesInTest, ValuesInSingleElementArray)
 
 TEST (ValuesInTest, ValuesInVector)
 
 TEST (ValuesInTest, ValuesInIteratorRange)
 
 TEST (ValuesInTest, ValuesInSingleElementIteratorRange)
 
 TEST (ValuesInTest, ValuesInEmptyIteratorRange)
 
 TEST (ValuesTest, ValuesWorks)
 
 TEST (ValuesTest, ValuesWorksForValuesOfCompatibleTypes)
 
 TEST (ValuesTest, ValuesWorksForMaxLengthList)
 
 TEST (ValuesTest, ValuesWithSingleParameter)
 
 TEST (BoolTest, BoolWorks)
 
 TEST (CombineTest, CombineWithTwoParameters)
 
 TEST (CombineTest, CombineWithThreeParameters)
 
 TEST (CombineTest, CombineWithFirstParameterSingleValue)
 
 TEST (CombineTest, CombineWithSecondParameterSingleValue)
 
 TEST (CombineTest, CombineWithFirstParameterEmptyRange)
 
 TEST (CombineTest, CombineWithSecondParameterEmptyRange)
 
 TEST (CombineTest, CombineWithMaxNumberOfParameters)
 
 TEST (CombineTest, NonDefaultConstructAssign)
 
 TEST (ParamGeneratorTest, AssignmentWorks)
 
 TEST_P (TestGenerationTest, TestsExpandedAndRun)
 
 INSTANTIATE_TEST_SUITE_P (TestExpansionModule, TestGenerationTest, ValuesIn(test_generation_params))
 
 TEST_P (GeneratorEvaluationTest, GeneratorsEvaluatedInMain)
 
 INSTANTIATE_TEST_SUITE_P (GenEvalModule, GeneratorEvaluationTest, Values(GeneratorEvaluationTest::param_value()))
 
 TEST_P (ExternalGeneratorTest, ExternalGenerator)
 
 INSTANTIATE_TEST_SUITE_P (ExternalGeneratorModule, ExternalGeneratorTest, extern_gen)
 
 TEST_P (ExternalInstantiationTest, IsMultipleOf33)
 
 TEST_P (MultipleInstantiationTest, AllowsMultipleInstances)
 
 INSTANTIATE_TEST_SUITE_P (Sequence1, MultipleInstantiationTest, Values(1, 2))
 
 INSTANTIATE_TEST_SUITE_P (Sequence2, MultipleInstantiationTest, Range(3, 5))
 
 TEST_P (InstantiationInMultipleTranslationUnitsTest, IsMultipleOf42)
 
 INSTANTIATE_TEST_SUITE_P (Sequence1, InstantiationInMultipleTranslationUnitsTest, Values(42, 42 *2))
 
 TEST_P (SeparateInstanceTest, TestsRunInSeparateInstances)
 
 INSTANTIATE_TEST_SUITE_P (FourElemSequence, SeparateInstanceTest, Range(1, 4))
 
 TEST_P (NamingTest, TestsReportCorrectNamesAndParameters)
 
 INSTANTIATE_TEST_SUITE_P (ZeroToFiveSequence, NamingTest, Range(0, 5))
 
 TEST_P (PREFIX_WITH_MACRO(NamingTest), PREFIX_WITH_FOO(SomeTestName))
 
 INSTANTIATE_TEST_SUITE_P (FortyTwo, MacroNamingTest, Values(42))
 
 TEST_F (PREFIX_WITH_MACRO(NamingTestNonParametrized), PREFIX_WITH_FOO(SomeTestName))
 
 TEST_P (CustomFunctorNamingTest, CustomTestNames)
 
 INSTANTIATE_TEST_SUITE_P (CustomParamNameFunctor, CustomFunctorNamingTest, Values(std::string("FunctorName")), CustomParamNameFunctor())
 
 INSTANTIATE_TEST_SUITE_P (AllAllowedCharacters, CustomFunctorNamingTest, Values("abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ","01234567890_"), CustomParamNameFunctor())
 
std::string CustomParamNameFunction (const ::testing::TestParamInfo< std::string > &inf)
 
 TEST_P (CustomFunctionNamingTest, CustomTestNames)
 
 INSTANTIATE_TEST_SUITE_P (CustomParamNameFunction, CustomFunctionNamingTest, Values(std::string("FunctionName")), CustomParamNameFunction)
 
 INSTANTIATE_TEST_SUITE_P (CustomParamNameFunctionP, CustomFunctionNamingTest, Values(std::string("FunctionNameP")),&CustomParamNameFunction)
 
 TEST_P (CustomLambdaNamingTest, CustomTestNames)
 
 INSTANTIATE_TEST_SUITE_P (CustomParamNameLambda, CustomLambdaNamingTest, Values(std::string("LambdaName")), [](const ::testing::TestParamInfo< std::string > &inf){return inf.param;})
 
 TEST (CustomNamingTest, CheckNameRegistry)
 
 TEST_P (CustomIntegerNamingTest, TestsReportCorrectNames)
 
 INSTANTIATE_TEST_SUITE_P (PrintToString, CustomIntegerNamingTest, Range(0, 5),::testing::PrintToStringParamName())
 
std::ostream & operator<< (std::ostream &stream, const CustomStruct &val)
 
 TEST_P (CustomStructNamingTest, TestsReportCorrectNames)
 
 INSTANTIATE_TEST_SUITE_P (PrintToString, CustomStructNamingTest, Values(CustomStruct(0), CustomStruct(1)),::testing::PrintToStringParamName())
 
 TEST_P (StatefulNamingTest, TestsReportCorrectNames)
 
 INSTANTIATE_TEST_SUITE_P (StatefulNamingFunctor, StatefulNamingTest, Range(0, 5), StatefulNamingFunctor())
 
 TEST_P (CommentTest, TestsCorrectlyReportUnstreamableParams)
 
 INSTANTIATE_TEST_SUITE_P (InstantiationWithComments, CommentTest, Values(Unstreamable(1)))
 
 TEST_F (NonParameterizedBaseTest, FixtureIsInitialized)
 
 TEST_P (ParameterizedDerivedTest, SeesSequence)
 
 TEST_F (ParameterizedDeathTest, GetParamDiesFromTestF)
 
 INSTANTIATE_TEST_SUITE_P (RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5))
 
 TEST_P (MyEnumTest, ChecksParamMoreThanZero)
 
 INSTANTIATE_TEST_SUITE_P (MyEnumTests, MyEnumTest,::testing::Values(ENUM1, ENUM2, 0))
 
int main (int argc, char **argv)
 

Variables

const int test_generation_params [] = {36, 42, 72}
 
ParamGenerator< int > extern_gen
 

Macro Definition Documentation

#define PREFIX_WITH_FOO (   test_name)    Foo##test_name
#define PREFIX_WITH_MACRO (   test_name)    Macro##test_name

Enumeration Type Documentation

enum MyEnums
Enumerator
ENUM1 
ENUM2 
ENUM3 

Function Documentation

template<typename T >
::std::string PrintValue ( const T &  value)

References testing::PrintToString().

Referenced by VerifyGenerator().

template<typename T , size_t N>
void VerifyGenerator ( const ParamGenerator< T > &  generator,
const T(&)  expected_values[N] 
)

References ASSERT_FALSE, EXPECT_TRUE, i, and PrintValue().

Referenced by TEST().

template<typename T >
void VerifyGeneratorIsEmpty ( const ParamGenerator< T > &  generator)

References EXPECT_TRUE.

Referenced by TEST().

TEST ( IteratorTest  ,
ParamIteratorConformsToForwardIteratorConcept   
)
TEST ( RangeTest  ,
IntRangeWithDefaultStep   
)
TEST ( RangeTest  ,
IntRangeSingleValue   
)
TEST ( RangeTest  ,
IntRangeEmpty   
)
TEST ( RangeTest  ,
IntRangeWithCustomStep   
)
TEST ( RangeTest  ,
IntRangeWithCustomStepOverUpperBound   
)
TEST ( RangeTest  ,
WorksWithACustomType   
)
TEST ( RangeTest  ,
WorksWithACustomTypeWithDifferentIncrementType   
)
TEST ( ValuesInTest  ,
ValuesInArray   
)
TEST ( ValuesInTest  ,
ValuesInConstArray   
)
TEST ( ValuesInTest  ,
ValuesInSingleElementArray   
)
TEST ( ValuesInTest  ,
ValuesInVector   
)
TEST ( ValuesInTest  ,
ValuesInIteratorRange   
)
TEST ( ValuesInTest  ,
ValuesInSingleElementIteratorRange   
)
TEST ( ValuesInTest  ,
ValuesInEmptyIteratorRange   
)
TEST ( ValuesTest  ,
ValuesWorks   
)
TEST ( ValuesTest  ,
ValuesWorksForValuesOfCompatibleTypes   
)
TEST ( ValuesTest  ,
ValuesWorksForMaxLengthList   
)
TEST ( ValuesTest  ,
ValuesWithSingleParameter   
)
TEST ( BoolTest  ,
BoolWorks   
)
TEST ( CombineTest  ,
CombineWithTwoParameters   
)
TEST ( CombineTest  ,
CombineWithThreeParameters   
)
TEST ( CombineTest  ,
CombineWithFirstParameterSingleValue   
)
TEST ( CombineTest  ,
CombineWithSecondParameterSingleValue   
)
TEST ( CombineTest  ,
CombineWithFirstParameterEmptyRange   
)
TEST ( CombineTest  ,
CombineWithSecondParameterEmptyRange   
)
TEST ( CombineTest  ,
CombineWithMaxNumberOfParameters   
)
TEST ( CombineTest  ,
NonDefaultConstructAssign   
)
TEST ( ParamGeneratorTest  ,
AssignmentWorks   
)
TEST_P ( TestGenerationTest  ,
TestsExpandedAndRun   
)
INSTANTIATE_TEST_SUITE_P ( TestExpansionModule  ,
TestGenerationTest  ,
ValuesIn(test_generation_params  
)
INSTANTIATE_TEST_SUITE_P ( GenEvalModule  ,
GeneratorEvaluationTest  ,
Values(GeneratorEvaluationTest::param_value())   
)
TEST_P ( ExternalGeneratorTest  ,
ExternalGenerator   
)
INSTANTIATE_TEST_SUITE_P ( ExternalGeneratorModule  ,
ExternalGeneratorTest  ,
extern_gen   
)
TEST_P ( ExternalInstantiationTest  ,
IsMultipleOf33   
)

References EXPECT_EQ.

TEST_P ( MultipleInstantiationTest  ,
AllowsMultipleInstances   
)
INSTANTIATE_TEST_SUITE_P ( Sequence1  ,
MultipleInstantiationTest  ,
Values(1, 2)   
)
INSTANTIATE_TEST_SUITE_P ( Sequence2  ,
MultipleInstantiationTest  ,
Range(3, 5)   
)
INSTANTIATE_TEST_SUITE_P ( Sequence1  ,
InstantiationInMultipleTranslationUnitsTest  ,
Values(42, 42 *2)   
)
TEST_P ( SeparateInstanceTest  ,
TestsRunInSeparateInstances   
)
INSTANTIATE_TEST_SUITE_P ( FourElemSequence  ,
SeparateInstanceTest  ,
Range(1, 4)   
)
INSTANTIATE_TEST_SUITE_P ( ZeroToFiveSequence  ,
NamingTest  ,
Range(0, 5)   
)
INSTANTIATE_TEST_SUITE_P ( FortyTwo  ,
MacroNamingTest  ,
Values(42)   
)
TEST_F ( PREFIX_WITH_MACRO(NamingTestNonParametrized)  ,
PREFIX_WITH_FOO(SomeTestName)   
)
TEST_P ( CustomFunctorNamingTest  ,
CustomTestNames   
)
INSTANTIATE_TEST_SUITE_P ( CustomParamNameFunctor  ,
CustomFunctorNamingTest  ,
Values(std::string("FunctorName"))  ,
CustomParamNameFunctor()   
)
INSTANTIATE_TEST_SUITE_P ( AllAllowedCharacters  ,
CustomFunctorNamingTest  ,
Values("abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ","01234567890_")  ,
CustomParamNameFunctor()   
)
std::string CustomParamNameFunction ( const ::testing::TestParamInfo< std::string > &  inf)
inline

Referenced by TEST_P().

INSTANTIATE_TEST_SUITE_P ( CustomParamNameFunction  ,
CustomFunctionNamingTest  ,
Values(std::string("FunctionName"))  ,
CustomParamNameFunction   
)
INSTANTIATE_TEST_SUITE_P ( CustomParamNameFunctionP  ,
CustomFunctionNamingTest  ,
Values(std::string("FunctionNameP"))  ,
CustomParamNameFunction 
)
TEST_P ( CustomLambdaNamingTest  ,
CustomTestNames   
)
INSTANTIATE_TEST_SUITE_P ( CustomParamNameLambda  ,
CustomLambdaNamingTest  ,
Values(std::string("LambdaName"))  ,
[] (const ::testing::TestParamInfo< std::string > &inf){return inf.param;}   
)
INSTANTIATE_TEST_SUITE_P ( PrintToString  ,
CustomIntegerNamingTest  ,
Range(0, 5)  ,
::testing::PrintToStringParamName()   
)
std::ostream& operator<< ( std::ostream &  stream,
const CustomStruct val 
)

References CustomStruct::x.

INSTANTIATE_TEST_SUITE_P ( PrintToString  ,
CustomStructNamingTest  ,
Values(CustomStruct(0), CustomStruct(1))  ,
::testing::PrintToStringParamName()   
)
INSTANTIATE_TEST_SUITE_P ( StatefulNamingFunctor  ,
StatefulNamingTest  ,
Range(0, 5)  ,
StatefulNamingFunctor()   
)
INSTANTIATE_TEST_SUITE_P ( InstantiationWithComments  ,
CommentTest  ,
Values(Unstreamable(1))   
)
TEST_F ( NonParameterizedBaseTest  ,
FixtureIsInitialized   
)

References EXPECT_EQ.

TEST_P ( ParameterizedDerivedTest  ,
SeesSequence   
)

References EXPECT_EQ.

TEST_F ( ParameterizedDeathTest  ,
GetParamDiesFromTestF   
)
INSTANTIATE_TEST_SUITE_P ( RangeZeroToFive  ,
ParameterizedDerivedTest  ,
Range(0, 5)   
)
TEST_P ( MyEnumTest  ,
ChecksParamMoreThanZero   
)
INSTANTIATE_TEST_SUITE_P ( MyEnumTests  ,
MyEnumTest  ,
::testing::Values(ENUM1, ENUM2, 0)   
)

Variable Documentation

const int test_generation_params[] = {36, 42, 72}
ParamGenerator<int> extern_gen

Referenced by TEST_P().