<commit_before>#pragma once

#include <string>
#include <vector>
#include <set>
#include <map>
#include <iostream>

#include <stdio.h>

#include "meta.h"
#include "util.h"

// define some common lists of types
typedef unittest::type_list<int,
                               unsigned int,
                               float> ThirtyTwoBitTypes;

typedef unittest::type_list<long long,
                               unsigned long long,
                               double> SixtyFourBitTypes;

typedef unittest::type_list<char,
                               signed char,
                               unsigned char,
                               short,
                               unsigned short,
                               int,
                               unsigned int,
                               long,
                               unsigned long,
                               long long,
                               unsigned long long> IntegralTypes;

typedef unittest::type_list<signed char,
                               signed short,
                               signed int,
                               signed long,
                               signed long long> SignedIntegralTypes;

typedef unittest::type_list<unsigned char,
                               unsigned short,
                               unsigned int,
                               unsigned long,
                               unsigned long long> UnsignedIntegralTypes;

typedef unittest::type_list<char,
                               signed char,
                               unsigned char> ByteTypes;

typedef unittest::type_list<char,
                               signed char,
                               unsigned char,
                               short,
                               unsigned short> SmallIntegralTypes;

typedef unittest::type_list<long long,
                              unsigned long long> LargeIntegralTypes;

typedef unittest::type_list<float
#if __CUDA_ARCH__ >= 130
                              , double
#endif // __CUDA_ARCH__
                             > FloatTypes;

typedef unittest::type_list<char,
                              signed char,
                              unsigned char,
                              short,
                              unsigned short,
                              int,
                              unsigned int,
                              long,
                              unsigned long,
                              long long,
                              unsigned long long,
                              float
#if __CUDA_ARCH__ >= 130
                              , double
#endif // __CUDA_ARCH__
                              > NumericTypes;

inline std::string base_class_name(const char *name)
{
  std::string result = name;
  
  // if the name begins with "struct ", chop it off
  result.replace(result.find("struct ") == 0 ? 0 : result.size(),
                 7,
                 "");

  // chop everything including and after first "<"
  return result.replace(result.find_first_of("<"),
                        result.size(),
                        "");
}

enum TestStatus { Pass = 0, Failure = 1, KnownFailure = 2, Error = 3, UnknownException = 4};

typedef std::set<std::string>              ArgumentSet;
typedef std::map<std::string, std::string> ArgumentMap;


class UnitTest {
    public:
        std::string name;
        UnitTest() {}
        UnitTest(const char * name);
        virtual void run() {};

        bool operator<(const UnitTest& u) const 
        {
            return name < u.name;
        }
};


class UnitTestDriver {
  typedef std::map<std::string, UnitTest*> TestMap;

  TestMap test_map;<commit_msg>add virtual destructor to UnitTest to silence gcc 4.1 warning<commit_after>#pragma once

#include <string>
#include <vector>
#include <set>
#include <map>
#include <iostream>

#include <stdio.h>

#include "meta.h"
#include "util.h"

// define some common lists of types
typedef unittest::type_list<int,
                               unsigned int,
                               float> ThirtyTwoBitTypes;

typedef unittest::type_list<long long,
                               unsigned long long,
                               double> SixtyFourBitTypes;

typedef unittest::type_list<char,
                               signed char,
                               unsigned char,
                               short,
                               unsigned short,
                               int,
                               unsigned int,
                               long,
                               unsigned long,
                               long long,
                               unsigned long long> IntegralTypes;

typedef unittest::type_list<signed char,
                               signed short,
                               signed int,
                               signed long,
                               signed long long> SignedIntegralTypes;

typedef unittest::type_list<unsigned char,
                               unsigned short,
                               unsigned int,
                               unsigned long,
                               unsigned long long> UnsignedIntegralTypes;

typedef unittest::type_list<char,
                               signed char,
                               unsigned char> ByteTypes;

typedef unittest::type_list<char,
                               signed char,
                               unsigned char,
                               short,
                               unsigned short> SmallIntegralTypes;

typedef unittest::type_list<long long,
                              unsigned long long> LargeIntegralTypes;

typedef unittest::type_list<float
#if __CUDA_ARCH__ >= 130
                              , double
#endif // __CUDA_ARCH__
                             > FloatTypes;

typedef unittest::type_list<char,
                              signed char,
                              unsigned char,
                              short,
                              unsigned short,
                              int,
                              unsigned int,
                              long,
                              unsigned long,
                              long long,
                              unsigned long long,
                              float
#if __CUDA_ARCH__ >= 130
                              , double
#endif // __CUDA_ARCH__
                              > NumericTypes;

inline std::string base_class_name(const char *name)
{
  std::string result = name;
  
  // if the name begins with "struct ", chop it off
  result.replace(result.find("struct ") == 0 ? 0 : result.size(),
                 7,
                 "");

  // chop everything including and after first "<"
  return result.replace(result.find_first_of("<"),
                        result.size(),
                        "");
}

enum TestStatus { Pass = 0, Failure = 1, KnownFailure = 2, Error = 3, UnknownException = 4};

typedef std::set<std::string>              ArgumentSet;
typedef std::map<std::string, std::string> ArgumentMap;


class UnitTest {
    public:
        std::string name;
        UnitTest() {}
        UnitTest(const char * name);
        virtual ~UnitTest() {}
        virtual void run() {}

        bool operator<(const UnitTest& u) const 
        {
            return name < u.name;
        }
};


class UnitTestDriver {
  typedef std::map<std::string, UnitTest*> TestMap;

  TestMap test_map;
{'fraction_non_alphanumeric': 0.07059602649006623, 'fraction_numerical': 0.003973509933774834, 'mean_word_length': 1.0452329360780066, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7465370', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1650, 'n_words': 458}