Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::internal::ParameterizedTestCaseInfo< TestCase > Class Template Reference

#include <gtest-param-util.h>

Inheritance diagram for testing::internal::ParameterizedTestCaseInfo< TestCase >:
Collaboration diagram for testing::internal::ParameterizedTestCaseInfo< TestCase >:

Public Types

typedef TestCase::ParamType ParamType
 
typedef ParamNameGenFunc< ParamType >::Type ParamNameGeneratorFunc
 

Public Member Functions

typedef ParamGenerator (GeneratorCreationFunc)()
 
 ParameterizedTestCaseInfo (const char *name, CodeLocation code_location)
 
virtual const std::string & GetTestCaseName () const
 
virtual TypeId GetTestCaseTypeId () const
 
void AddTestPattern (const char *test_case_name, const char *test_base_name, TestMetaFactoryBase< ParamType > *meta_factory)
 
int AddTestCaseInstantiation (const std::string &instantiation_name, GeneratorCreationFunc *func, ParamNameGeneratorFunc *name_func, const char *file, int line)
 
virtual void RegisterTests ()
 
- Public Member Functions inherited from testing::internal::ParameterizedTestCaseInfoBase
virtual ~ParameterizedTestCaseInfoBase ()
 

Additional Inherited Members

- Protected Member Functions inherited from testing::internal::ParameterizedTestCaseInfoBase
 ParameterizedTestCaseInfoBase ()
 

Detailed Description

template<class TestCase>
class testing::internal::ParameterizedTestCaseInfo< TestCase >

Definition at line 494 of file gtest-param-util.h.

Member Typedef Documentation

◆ ParamNameGeneratorFunc

◆ ParamType

template<class TestCase >
TestCase::ParamType testing::internal::ParameterizedTestCaseInfo< TestCase >::ParamType

Definition at line 499 of file gtest-param-util.h.

Constructor & Destructor Documentation

◆ ParameterizedTestCaseInfo()

template<class TestCase >
testing::internal::ParameterizedTestCaseInfo< TestCase >::ParameterizedTestCaseInfo ( const char * name,
CodeLocation code_location )
inlineexplicit

Definition at line 504 of file gtest-param-util.h.

506 : test_case_name_(name), code_location_(code_location) {}
std::string name

Member Function Documentation

◆ AddTestCaseInstantiation()

template<class TestCase >
int testing::internal::ParameterizedTestCaseInfo< TestCase >::AddTestCaseInstantiation ( const std::string & instantiation_name,
GeneratorCreationFunc * func,
ParamNameGeneratorFunc * name_func,
const char * file,
int line )
inline

Definition at line 527 of file gtest-param-util.h.

530 {
531 instantiations_.push_back(
532 InstantiationInfo(instantiation_name, func, name_func, file, line));
533 return 0; // Return value used only to run this method in namespace scope.
534 }

◆ AddTestPattern()

template<class TestCase >
void testing::internal::ParameterizedTestCaseInfo< TestCase >::AddTestPattern ( const char * test_case_name,
const char * test_base_name,
TestMetaFactoryBase< ParamType > * meta_factory )
inline

Definition at line 518 of file gtest-param-util.h.

520 {
521 tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
522 test_base_name,
523 meta_factory)));
524 }

◆ GetTestCaseName()

template<class TestCase >
virtual const std::string & testing::internal::ParameterizedTestCaseInfo< TestCase >::GetTestCaseName ( ) const
inlinevirtual

Implements testing::internal::ParameterizedTestCaseInfoBase.

Definition at line 509 of file gtest-param-util.h.

509{ return test_case_name_; }

◆ GetTestCaseTypeId()

template<class TestCase >
virtual TypeId testing::internal::ParameterizedTestCaseInfo< TestCase >::GetTestCaseTypeId ( ) const
inlinevirtual

Implements testing::internal::ParameterizedTestCaseInfoBase.

Definition at line 511 of file gtest-param-util.h.

511{ return GetTypeId<TestCase>(); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParamGenerator()

template<class TestCase >
typedef testing::internal::ParameterizedTestCaseInfo< TestCase >::ParamGenerator ( GeneratorCreationFunc )

◆ RegisterTests()

template<class TestCase >
virtual void testing::internal::ParameterizedTestCaseInfo< TestCase >::RegisterTests ( )
inlinevirtual

Implements testing::internal::ParameterizedTestCaseInfoBase.

Definition at line 540 of file gtest-param-util.h.

540 {
541 for (typename TestInfoContainer::iterator test_it = tests_.begin();
542 test_it != tests_.end(); ++test_it) {
543 linked_ptr<TestInfo> test_info = *test_it;
544 for (typename InstantiationContainer::iterator gen_it =
545 instantiations_.begin(); gen_it != instantiations_.end();
546 ++gen_it) {
547 const std::string& instantiation_name = gen_it->name;
548 ParamGenerator<ParamType> generator((*gen_it->generator)());
549 ParamNameGeneratorFunc* name_func = gen_it->name_func;
550 const char* file = gen_it->file;
551 int line = gen_it->line;
552
553 std::string test_case_name;
554 if ( !instantiation_name.empty() )
555 test_case_name = instantiation_name + "/";
556 test_case_name += test_info->test_case_base_name;
557
558 size_t i = 0;
559 std::set<std::string> test_param_names;
560 for (typename ParamGenerator<ParamType>::iterator param_it =
561 generator.begin();
562 param_it != generator.end(); ++param_it, ++i) {
563 Message test_name_stream;
564
565 std::string param_name = name_func(
566 TestParamInfo<ParamType>(*param_it, i));
567
568 GTEST_CHECK_(IsValidParamName(param_name))
569 << "Parameterized test name '" << param_name
570 << "' is invalid, in " << file
571 << " line " << line << std::endl;
572
573 GTEST_CHECK_(test_param_names.count(param_name) == 0)
574 << "Duplicate parameterized test name '" << param_name
575 << "', in " << file << " line " << line << std::endl;
576
577 test_param_names.insert(param_name);
578
579 test_name_stream << test_info->test_base_name << "/" << param_name;
581 test_case_name.c_str(),
582 test_name_stream.GetString().c_str(),
583 NULL, // No type parameter.
584 PrintToString(*param_it).c_str(),
585 code_location_,
587 TestCase::SetUpTestCase,
588 TestCase::TearDownTestCase,
589 test_info->test_meta_factory->CreateTestFactory(*param_it));
590 } // for param_it
591 } // for gen_it
592 } // for test_it
593 } // RegisterTests
typedef ParamGenerator(GeneratorCreationFunc)()
ParamNameGenFunc< ParamType >::Type ParamNameGeneratorFunc
#define GTEST_CHECK_(condition)
GTEST_API_ TestInfo * MakeAndRegisterTestInfo(const char *test_case_name, const char *name, const char *type_param, const char *value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase *factory)
Definition gtest.cc:2561
Here is the call graph for this function:

The documentation for this class was generated from the following file: