<commit_before>#include <utility>

#include <cppunit/Portability.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/TestFactoryRegistry.h>

#if CPPUNIT_USE_TYPEINFO_NAME
#  include "cppunit/extensions/TypeInfoHelper.h"
#endif


namespace CppUnit {

TestFactoryRegistry::TestFactoryRegistry( std::string name ) :
    m_name( name )
{
}

TestFactoryRegistry::~TestFactoryRegistry()
{
  for ( Factories::iterator it = m_factories.begin(); it != m_factories.end(); ++it )
  {
    TestFactory *factory = it->second;
    delete factory;
  }
}


TestFactoryRegistry &
TestFactoryRegistry::getRegistry()
{
  static TestFactoryRegistry registry;
  return registry;
}


TestFactoryRegistry &
TestFactoryRegistry::getRegistry( const std::string &name )
{
// No clean-up at the current time => memory leaks.
// Need to find a way to solve the folowing issue:
// getRegistry().registryFactory( "Functionnal", 
//                                getRegistry( "Functionnal" ) );
// => the test factory registry "Functionnal" would be
// destroyed twice: once by the map below, once by the getRegistry() factory.
  static NamedRegistries registries;

  NamedRegistries::const_iterator foundIt = registries.find( name );
  if ( foundIt == registries.end() )
  {
    TestFactoryRegistry *factory = new TestFactoryRegistry( name );
    registries.insert( std::make_pair( name, factory ) );
    return *factory;
  }
  return *foundIt->second;
}


void 
TestFactoryRegistry::registerFactory( const std::string &name,
                                      TestFactory *factory )
{
  m_factories[name] = factory;
}


void 
TestFactoryRegistry::registerFactory( TestFactory *factory )
{
  static int serialNumber = 1;

    OStringStream ost;
    ost << "@Dummy@" << serialNumber++;

    registerFactory( ost.str(), factory );
}<commit_msg>*** empty log message ***<commit_after>#include <utility>

#include <cppunit/Portability.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/TestFactoryRegistry.h>

#if CPPUNIT_USE_TYPEINFO_NAME
#  include "cppunit/extensions/TypeInfoHelper.h"
#endif


namespace CppUnit {

TestFactoryRegistry::TestFactoryRegistry( std::string name ) :
    m_name( name )
{
}

TestFactoryRegistry::~TestFactoryRegistry()
{
  for ( Factories::iterator it = m_factories.begin(); it != m_factories.end(); ++it )
  {
    TestFactory *factory = it->second;
    delete factory;
  }
}


TestFactoryRegistry &
TestFactoryRegistry::getRegistry()
{
  static TestFactoryRegistry registry;
  return registry;
}


TestFactoryRegistry &
TestFactoryRegistry::getRegistry( const std::string &name )
{
// No clean-up at the current time => memory leaks.
// Need to find a way to solve the folowing issue:
// getRegistry().registryFactory( "Functionnal", 
//                                getRegistry( "Functionnal" ) );
// => the test factory registry "Functionnal" would be
// destroyed twice: once by the map below, once by the getRegistry() factory.
  static NamedRegistries registries;

  NamedRegistries::const_iterator foundIt = registries.find( name );
  if ( foundIt == registries.end() )
  {
    TestFactoryRegistry *factory = new TestFactoryRegistry( name );
    registries.insert( std::make_pair( name, factory ) );
    return *factory;
  }
  return *foundIt->second;
}


void 
TestFactoryRegistry::registerFactory( const std::string &name,
                                      TestFactory *factory )
{
  m_factories[name] = factory;
}


void 
TestFactoryRegistry::registerFactory( TestFactory *factory )
{
    static int serialNumber = 1;

    OStringStream ost;
    ost << "@Dummy@" << serialNumber++;

    registerFactory( ost.str(), factory );
}
{'fraction_non_alphanumeric': 0.11729405346426623, 'fraction_numerical': 0.0005455537370430987, 'mean_word_length': 3.8569536423841058, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6522193', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1067, 'n_words': 272}