tesseract v5.3.3.20231005
testing::internal::TypeParameterizedTestSuiteRegistry Class Reference

#include <gtest-param-util.h>

Public Member Functions

void RegisterTestSuite (const char *test_suite_name, CodeLocation code_location)
 
void RegisterInstantiation (const char *test_suite_name)
 
void CheckForInstantiations ()
 

Detailed Description

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

Member Function Documentation

◆ CheckForInstantiations()

void testing::internal::TypeParameterizedTestSuiteRegistry::CheckForInstantiations ( )

Definition at line 541 of file gtest.cc.

541 {
542 const auto& ignored = *GetIgnoredParameterizedTestSuites();
543 for (const auto& testcase : suites_) {
544 if (testcase.second.instantiated) continue;
545 if (ignored.find(testcase.first) != ignored.end()) continue;
546
547 std::string message =
548 "Type parameterized test suite " + testcase.first +
549 " is defined via REGISTER_TYPED_TEST_SUITE_P, but never instantiated "
550 "via INSTANTIATE_TYPED_TEST_SUITE_P. None of the test cases will run."
551 "\n\n"
552 "Ideally, TYPED_TEST_P definitions should only ever be included as "
553 "part of binaries that intend to use them. (As opposed to, for "
554 "example, being placed in a library that may be linked in to get other "
555 "utilities.)"
556 "\n\n"
557 "To suppress this error for this test suite, insert the following line "
558 "(in a non-header) in the namespace it is defined in:"
559 "\n\n"
560 "GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(" +
561 testcase.first + ");";
562
563 std::string full_name =
564 "UninstantiatedTypeParameterizedTestSuite<" + testcase.first + ">";
565 RegisterTest( //
566 "GoogleTestVerification", full_name.c_str(),
567 nullptr, // No type parameter.
568 nullptr, // No value parameter.
569 testcase.second.code_location.file.c_str(),
570 testcase.second.code_location.line, [message, testcase] {
571 return new FailureTest(testcase.second.code_location, message,
572 kErrorOnUninstantiatedTypeParameterizedTest);
573 });
574 }
575}
TestInfo * RegisterTest(const char *test_suite_name, const char *test_name, const char *type_param, const char *value_param, const char *file, int line, Factory factory)
Definition: gtest.h:2455
std::set< std::string > * GetIgnoredParameterizedTestSuites()
Definition: gtest.cc:458

◆ RegisterInstantiation()

void testing::internal::TypeParameterizedTestSuiteRegistry::RegisterInstantiation ( const char *  test_suite_name)

Definition at line 530 of file gtest.cc.

531 {
532 auto it = suites_.find(std::string(test_suite_name));
533 if (it != suites_.end()) {
534 it->second.instantiated = true;
535 } else {
536 GTEST_LOG_(ERROR) << "Unknown type parameterized test suit '"
537 << test_suite_name << "'";
538 }
539}
@ ERROR
Definition: log.h:28
#define GTEST_LOG_(severity)
Definition: gtest-port.h:984

◆ RegisterTestSuite()

void testing::internal::TypeParameterizedTestSuiteRegistry::RegisterTestSuite ( const char *  test_suite_name,
CodeLocation  code_location 
)

Definition at line 524 of file gtest.cc.

525 {
526 suites_.emplace(std::string(test_suite_name),
527 TypeParameterizedTestSuiteInfo(code_location));
528}

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