Xmipp  v3.23.11-Nereus
Classes | Public Types | Public Member Functions | List of all members
testing::internal::ParameterizedTestSuiteInfo< TestSuite > Class Template Reference

#include <gtest-param-util.h>

Inheritance diagram for testing::internal::ParameterizedTestSuiteInfo< TestSuite >:
Inheritance graph
[legend]
Collaboration diagram for testing::internal::ParameterizedTestSuiteInfo< TestSuite >:
Collaboration graph
[legend]

Public Types

using ParamType = typename TestSuite::ParamType
 
using ParamNameGeneratorFunc = std::string(const TestParamInfo< ParamType > &)
 

Public Member Functions

typedef ParamGenerator (GeneratorCreationFunc)()
 
 ParameterizedTestSuiteInfo (const char *name, CodeLocation code_location)
 
const std::string & GetTestSuiteName () const override
 
TypeId GetTestSuiteTypeId () const override
 
void AddTestPattern (const char *test_suite_name, const char *test_base_name, TestMetaFactoryBase< ParamType > *meta_factory, CodeLocation code_location)
 
int AddTestSuiteInstantiation (const std::string &instantiation_name, GeneratorCreationFunc *func, ParamNameGeneratorFunc *name_func, const char *file, int line)
 
void RegisterTests () override
 
- Public Member Functions inherited from testing::internal::ParameterizedTestSuiteInfoBase
virtual ~ParameterizedTestSuiteInfoBase ()
 

Additional Inherited Members

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

Detailed Description

template<class TestSuite>
class testing::internal::ParameterizedTestSuiteInfo< TestSuite >

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

Member Typedef Documentation

◆ ParamNameGeneratorFunc

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

◆ ParamType

template<class TestSuite>
using testing::internal::ParameterizedTestSuiteInfo< TestSuite >::ParamType = typename TestSuite::ParamType

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

Constructor & Destructor Documentation

◆ ParameterizedTestSuiteInfo()

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

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

518  : test_suite_name_(name), code_location_(code_location) {}

Member Function Documentation

◆ AddTestPattern()

template<class TestSuite>
void testing::internal::ParameterizedTestSuiteInfo< TestSuite >::AddTestPattern ( const char *  test_suite_name,
const char *  test_base_name,
TestMetaFactoryBase< ParamType > *  meta_factory,
CodeLocation  code_location 
)
inline

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

534  {
535  tests_.push_back(std::shared_ptr<TestInfo>(new TestInfo(
536  test_suite_name, test_base_name, meta_factory, code_location)));
537  }

◆ AddTestSuiteInstantiation()

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

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

543  {
544  instantiations_.push_back(
545  InstantiationInfo(instantiation_name, func, name_func, file, line));
546  return 0; // Return value used only to run this method in namespace scope.
547  }

◆ GetTestSuiteName()

template<class TestSuite>
const std::string& testing::internal::ParameterizedTestSuiteInfo< TestSuite >::GetTestSuiteName ( ) const
inlineoverridevirtual

Implements testing::internal::ParameterizedTestSuiteInfoBase.

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

521  {
522  return test_suite_name_;
523  }

◆ GetTestSuiteTypeId()

template<class TestSuite>
TypeId testing::internal::ParameterizedTestSuiteInfo< TestSuite >::GetTestSuiteTypeId ( ) const
inlineoverridevirtual

Implements testing::internal::ParameterizedTestSuiteInfoBase.

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

525 { return GetTypeId<TestSuite>(); }

◆ ParamGenerator()

template<class TestSuite>
typedef testing::internal::ParameterizedTestSuiteInfo< TestSuite >::ParamGenerator ( GeneratorCreationFunc  )

◆ RegisterTests()

template<class TestSuite>
void testing::internal::ParameterizedTestSuiteInfo< TestSuite >::RegisterTests ( )
inlineoverridevirtual

Implements testing::internal::ParameterizedTestSuiteInfoBase.

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

553  {
554  bool generated_instantiations = false;
555 
556  for (typename TestInfoContainer::iterator test_it = tests_.begin();
557  test_it != tests_.end(); ++test_it) {
558  std::shared_ptr<TestInfo> test_info = *test_it;
559  for (typename InstantiationContainer::iterator gen_it =
560  instantiations_.begin();
561  gen_it != instantiations_.end(); ++gen_it) {
562  const std::string& instantiation_name = gen_it->name;
563  ParamGenerator<ParamType> generator((*gen_it->generator)());
564  ParamNameGeneratorFunc* name_func = gen_it->name_func;
565  const char* file = gen_it->file;
566  int line = gen_it->line;
567 
568  std::string test_suite_name;
569  if (!instantiation_name.empty())
570  test_suite_name = instantiation_name + "/";
571  test_suite_name += test_info->test_suite_base_name;
572 
573  size_t i = 0;
574  std::set<std::string> test_param_names;
575  for (typename ParamGenerator<ParamType>::iterator param_it =
576  generator.begin();
577  param_it != generator.end(); ++param_it, ++i) {
578  generated_instantiations = true;
579 
580  Message test_name_stream;
581 
582  std::string param_name =
583  name_func(TestParamInfo<ParamType>(*param_it, i));
584 
585  GTEST_CHECK_(IsValidParamName(param_name))
586  << "Parameterized test name '" << param_name
587  << "' is invalid, in " << file << " line " << line << std::endl;
588 
589  GTEST_CHECK_(test_param_names.count(param_name) == 0)
590  << "Duplicate parameterized test name '" << param_name << "', in "
591  << file << " line " << line << std::endl;
592 
593  test_param_names.insert(param_name);
594 
595  if (!test_info->test_base_name.empty()) {
596  test_name_stream << test_info->test_base_name << "/";
597  }
598  test_name_stream << param_name;
600  test_suite_name.c_str(), test_name_stream.GetString().c_str(),
601  nullptr, // No type parameter.
602  PrintToString(*param_it).c_str(), test_info->code_location,
606  test_info->test_meta_factory->CreateTestFactory(*param_it));
607  } // for param_it
608  } // for gen_it
609  } // for test_it
610 
611  if (!generated_instantiations) {
612  // There are no generaotrs, or they all generate nothing ...
613  InsertSyntheticTestCase(GetTestSuiteName(), code_location_,
614  !tests_.empty());
615  }
616  } // RegisterTests
GTEST_API_ void InsertSyntheticTestCase(const std::string &name, CodeLocation location, bool has_test_p)
static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite(const char *filename, int line_num)
::std::string PrintToString(const T &value)
#define i
#define GTEST_CHECK_(condition)
Definition: gtest-port.h:1025
GTEST_API_ TestInfo * MakeAndRegisterTestInfo(const char *test_suite_name, const char *name, const char *type_param, const char *value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, TearDownTestSuiteFunc tear_down_tc, TestFactoryBase *factory)
std::string(const TestParamInfo< ParamType > &) ParamNameGeneratorFunc
static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char *filename, int line_num)
const std::string & GetTestSuiteName() const override

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