umd/external/protobuf-2.6/gtest/fused-src/gtest/gtest-all.cc
bool Test::HasSameFixtureClass() {
  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
  const TestCase* const test_case = impl->current_test_case();

  // Info about the first test in the current test case.
  const internal::TestInfoImpl* const first_test_info =
      test_case->test_info_list()[0]->impl();
  const internal::TypeId first_fixture_id = first_test_info->fixture_class_id();
  const char* const first_test_name = first_test_info->name();

  // Info about the current test.
  const internal::TestInfoImpl* const this_test_info =
      impl->current_test_info()->impl();
  const internal::TypeId this_fixture_id = this_test_info->fixture_class_id();
  const char* const this_test_name = this_test_info->name();

  if (this_fixture_id != first_fixture_id) {
    // Is the first test defined using TEST?
    const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
    // Is this test defined using TEST?
    const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();

    if (first_is_TEST || this_is_TEST) {
      // The user mixed TEST and TEST_F in this test case - we'll tell
      // him/her how to fix it.

      // Gets the name of the TEST and the name of the TEST_F.  Note
      // that first_is_TEST and this_is_TEST cannot both be true, as
      // the fixture IDs are different for the two tests.
      const char* const TEST_name =
          first_is_TEST ? first_test_name : this_test_name;
      const char* const TEST_F_name =
          first_is_TEST ? this_test_name : first_test_name;

      ADD_FAILURE()
          << "All tests in the same test case must use the same test fixture\n"
          << "class, so mixing TEST_F and TEST in the same test case is\n"
          << "illegal.  In test case " << this_test_info->test_case_name()
          << ",\n"
          << "test " << TEST_F_name << " is defined using TEST_F but\n"
          << "test " << TEST_name << " is defined using TEST.  You probably\n"
          << "want to change the TEST to TEST_F or move it to another test\n"
          << "case.";
    } else {
      // The user defined two fixture classes with the same name in
      // two namespaces - we'll tell him/her how to fix it.
      ADD_FAILURE()
          << "All tests in the same test case must use the same test fixture\n"
          << "class.  However, in test case "
          << this_test_info->test_case_name() << ",\n"
          << "you defined test " << first_test_name
          << " and test " << this_test_name << "\n"
          << "using two different test fixture classes.  This can happen if\n"
          << "the two classes are from different namespaces or translation\n"
          << "units and have the same name.  You should probably rename one\n"
          << "of the classes to put the tests into different test cases.";
    }
    return false;
  }

  return true;
}
// Google Test requires all tests in the same test case to use the same test
// fixture class.  This function checks if the current test has the
// same fixture class as the first test in the current test case.  If
// yes, it returns true; otherwise it generates a Google Test failure and
// returns false.
Google Test requires all tests in the same test case to use the same test
fixture class.  This function checks if the current test has the
same fixture class as the first test in the current test case.  If
yes, it returns true; otherwise it generates a Google Test failure and
returns false.
Google Test requires all tests in the same test case to use the same test fixture class . This function checks if the current test has the same fixture class as the first test in the current test case . If yes it returns true ; otherwise it generates a Google Test failure and returns false .
bool Test::HasSameFixtureClass() {
  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
  const TestCase* const test_case = impl->current_test_case();
  const internal::TestInfoImpl* const first_test_info =
      test_case->test_info_list()[0]->impl();
  const internal::TypeId first_fixture_id = first_test_info->fixture_class_id();
  const char* const first_test_name = first_test_info->name();
  const internal::TestInfoImpl* const this_test_info =
      impl->current_test_info()->impl();
  const internal::TypeId this_fixture_id = this_test_info->fixture_class_id();
  const char* const this_test_name = this_test_info->name();
  if (this_fixture_id != first_fixture_id) {
    const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
    const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
    if (first_is_TEST || this_is_TEST) {
      const char* const TEST_name =
          first_is_TEST ? first_test_name : this_test_name;
      const char* const TEST_F_name =
          first_is_TEST ? this_test_name : first_test_name;
      ADD_FAILURE()
          << "All tests in the same test case must use the same test fixture\n"
          << "class, so mixing TEST_F and TEST in the same test case is\n"
          << "illegal.  In test case " << this_test_info->test_case_name()
          << ",\n"
          << "test " << TEST_F_name << " is defined using TEST_F but\n"
          << "test " << TEST_name << " is defined using TEST.  You probably\n"
          << "want to change the TEST to TEST_F or move it to another test\n"
          << "case.";
    } else {
      ADD_FAILURE()
          << "All tests in the same test case must use the same test fixture\n"
          << "class.  However, in test case "
          << this_test_info->test_case_name() << ",\n"
          << "you defined test " << first_test_name
          << " and test " << this_test_name << "\n"
          << "using two different test fixture classes.  This can happen if\n"
          << "the two classes are from different namespaces or translation\n"
          << "units and have the same name.  You should probably rename one\n"
          << "of the classes to put the tests into different test cases.";
    }
    return false;
  }
  return true;
}
bool Test :: HasSameFixtureClass ( ) { internal :: UnitTestImpl * const impl = internal :: GetUnitTestImpl ( ) ; const TestCase * const test_case = impl -> current_test_case ( ) ; const internal :: TestInfoImpl * const first_test_info = test_case -> test_info_list ( ) [ 0 ] -> impl ( ) ; const internal :: TypeId first_fixture_id = first_test_info -> fixture_class_id ( ) ; const char * const first_test_name = first_test_info -> name ( ) ; const internal :: TestInfoImpl * const this_test_info = impl -> current_test_info ( ) -> impl ( ) ; const internal :: TypeId this_fixture_id = this_test_info -> fixture_class_id ( ) ; const char * const this_test_name = this_test_info -> name ( ) ; if ( this_fixture_id != first_fixture_id ) { const bool first_is_TEST = first_fixture_id == internal :: GetTestTypeId ( ) ; const bool this_is_TEST = this_fixture_id == internal :: GetTestTypeId ( ) ; if ( first_is_TEST || this_is_TEST ) { const char * const TEST_name = first_is_TEST ? first_test_name : this_test_name ; const char * const TEST_F_name = first_is_TEST ? this_test_name : first_test_name ; ADD_FAILURE ( ) << " \n " << " \n " << " " << this_test_info -> test_case_name ( ) << " \n " << " " << TEST_F_name << " \n " << " " << TEST_name << " \n " << " \n " << " " ; } else { ADD_FAILURE ( ) << " \n " << " " << this_test_info -> test_case_name ( ) << " \n " << " " << first_test_name << " " << this_test_name << " \n " << " \n " << " \n " << " \n " << " " ; } return false ; } return true ; }
Google Test requires all tests in the same test case to use the same test
fixture class.
Google Test requires all tests in the same test case to use the same test fixture class .
// Info about the first test in the current test case. // Info about the current test. // Is the first test defined using TEST? // Is this test defined using TEST? // The user mixed TEST and TEST_F in this test case - we'll tell // him/her how to fix it. // Gets the name of the TEST and the name of the TEST_F.  Note // that first_is_TEST and this_is_TEST cannot both be true, as // the fixture IDs are different for the two tests. // The user defined two fixture classes with the same name in // two namespaces - we'll tell him/her how to fix it.