<commit_before>
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkTestMain.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

  Portions of this code are covered under the VTK copyright.
  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/


// This file is used to create TestDriver executables
// These executables are able to register a function pointer to a string name
// in a lookup table.   By including this file, it creates a main function
// that calls RegisterTests() then looks up the function pointer for the test
// specified on the command line.

#include <map>
#include <string>
#include <iostream>


typedef int (*MainFuncPointer)(int , char**);
std::map<std::string, MainFuncPointer> StringToTestFunctionMap;

#define REGISTER_TEST(test) \
extern int test(int, char**); \
StringToTestFunctionMap[#test] = test

void RegisterTests();
void PrintAvailableTests()
{
  std::cout << "Availiable tests:\n";
  std::map<std::string, MainFuncPointer>::iterator j = StringToTestFunctionMap.begin();
  while(j != StringToTestFunctionMap.end())
    {
    std::cout << j->first << "\n";
    ++j;
    }

}
int main(int ac, char** av)
{
  if(ac < 2)
    {
    PrintAvailableTests();
    std::cerr << "Usage: " << av[0] << " TestName\n";
    return -1;
    }
  RegisterTests();
  std::map<std::string, MainFuncPointer>::iterator j = StringToTestFunctionMap.find(av[1]);
  if(j != StringToTestFunctionMap.end())
    {
    MainFuncPointer f = j->second;
    return (*f)(ac-1, av+1);
    }
  PrintAvailableTests();
  std::cerr << "Failed: " << av[1] << ": No test registered with name " << av[1] << "\n";
  return -1;
}

<commit_msg>ENH: add win32 header for warnings<commit_after>
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkTestMain.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

  Portions of this code are covered under the VTK copyright.
  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/


// This file is used to create TestDriver executables
// These executables are able to register a function pointer to a string name
// in a lookup table.   By including this file, it creates a main function
// that calls RegisterTests() then looks up the function pointer for the test
// specified on the command line.
#include "itkWin32Header.h"
#include <map>
#include <string>
#include <iostream>


typedef int (*MainFuncPointer)(int , char**);
std::map<std::string, MainFuncPointer> StringToTestFunctionMap;

#define REGISTER_TEST(test) \
extern int test(int, char**); \
StringToTestFunctionMap[#test] = test

void RegisterTests();
void PrintAvailableTests()
{
  std::cout << "Availiable tests:\n";
  std::map<std::string, MainFuncPointer>::iterator j = StringToTestFunctionMap.begin();
  while(j != StringToTestFunctionMap.end())
    {
    std::cout << j->first << "\n";
    ++j;
    }

}
int main(int ac, char** av)
{
  if(ac < 2)
    {
    PrintAvailableTests();
    std::cerr << "Usage: " << av[0] << " TestName\n";
    return -1;
    }
  RegisterTests();
  std::map<std::string, MainFuncPointer>::iterator j = StringToTestFunctionMap.find(av[1]);
  if(j != StringToTestFunctionMap.end())
    {
    MainFuncPointer f = j->second;
    return (*f)(ac-1, av+1);
    }
  PrintAvailableTests();
  std::cerr << "Failed: " << av[1] << ": No test registered with name " << av[1] << "\n";
  return -1;
}


{'fraction_non_alphanumeric': 0.1849438202247191, 'fraction_numerical': 0.006741573033707865, 'mean_word_length': 4.081050228310502, 'pattern_counts': {'":': 2, '<': 61, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2940317', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1276, 'n_words': 409}