<commit_before>/*

    Copyright <NAME> and <NAME>, 2011, 2012, 2013

    This file is part of Lasercake.

    Lasercake is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    Lasercake is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with Lasercake.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef LASERCAKE_TEST_HEADER_HPP__
#define LASERCAKE_TEST_HEADER_HPP__

// At the top of your tests file,
// #define TESTS_FILE whichever_tests_file_you_are
// e.g. #define TESTS_FILE misc_utils_tests
// then include "test_header.hpp".
// At the bottom of your file, put
// REGISTER_TESTS // This must come last in the file.
//
// Also, add your test file identifier below to the list of
// DECLARE_TESTS_FILE(identifier).

// This emulates a part of the Boost.Test API but is significantly
// more lightweight.  Switching to this alone reduced the binary size
// by 1/3, the linking time by somewhat, and got rid of the last of
// the global constructors/destructors (save perhaps in Qt and
// separately-compiled libc / c++ std lib code that I haven't discovered).
// This also solves the problem that Clang-compiled Lasercake got into
// a mysterious infinite loop when trying to run the tests and that GDB
// had internal errors when trying to open that binary (Clang 3.2, GDB 7.5.1,
// Arch Linux x86_64, Jan 2013).

#include <boost/preprocessor/stringize.hpp>
#include "../config.hpp"

typedef int tests_file_id;
template<tests_file_id File> struct register_test_file;
#define DECLARE_TESTS_FILES_BEGIN \
  static const tests_file_id first_test_file = __COUNTER__ + 1;
#define DECLARE_TESTS_FILE(name) \
  static const tests_file_id name = __COUNTER__; \
  template<> struct register_test_file<name> { static void go(); };
#define DECLARE_TESTS_FILES_END \
  template<> struct register_test_file<__COUNTER__> { static void go() {} };

DECLARE_TESTS_FILES_BEGIN

DECLARE_TESTS_FILE(bbox_collision_detector_tests)
DECLARE_TESTS_FILE(borrowed_bitset_tests)
DECLARE_TESTS_FILE(bounds_checked_int_tests)
DECLARE_TESTS_FILE(misc_utils_tests)
DECLARE_TESTS_FILE(units_tests)

DECLARE_TESTS_FILES_END


//////////////////////////////////////////////////////////////////////////
//////// Test-registration code that uses no global constructors /////////
//////////////////////////////////////////////////////////////////////////

// The testing world is composed of test files, which are composed of test
// cases, which are composed of code and tests.  Test files are enumerated
// first-to-last in the above DECLARE_TESTS_FILES order
// via register_test_file<>'s recursion.  Within each file, test cases are<commit_msg>add patricia_trie_tests<commit_after>/*

    Copyright <NAME> and <NAME>, 2011, 2012, 2013

    This file is part of Lasercake.

    Lasercake is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    Lasercake is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with Lasercake.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef LASERCAKE_TEST_HEADER_HPP__
#define LASERCAKE_TEST_HEADER_HPP__

// At the top of your tests file,
// #define TESTS_FILE whichever_tests_file_you_are
// e.g. #define TESTS_FILE misc_utils_tests
// then include "test_header.hpp".
// At the bottom of your file, put
// REGISTER_TESTS // This must come last in the file.
//
// Also, add your test file identifier below to the list of
// DECLARE_TESTS_FILE(identifier).

// This emulates a part of the Boost.Test API but is significantly
// more lightweight.  Switching to this alone reduced the binary size
// by 1/3, the linking time by somewhat, and got rid of the last of
// the global constructors/destructors (save perhaps in Qt and
// separately-compiled libc / c++ std lib code that I haven't discovered).
// This also solves the problem that Clang-compiled Lasercake got into
// a mysterious infinite loop when trying to run the tests and that GDB
// had internal errors when trying to open that binary (Clang 3.2, GDB 7.5.1,
// Arch Linux x86_64, Jan 2013).

#include <boost/preprocessor/stringize.hpp>
#include "../config.hpp"

typedef int tests_file_id;
template<tests_file_id File> struct register_test_file;
#define DECLARE_TESTS_FILES_BEGIN \
  static const tests_file_id first_test_file = __COUNTER__ + 1;
#define DECLARE_TESTS_FILE(name) \
  static const tests_file_id name = __COUNTER__; \
  template<> struct register_test_file<name> { static void go(); };
#define DECLARE_TESTS_FILES_END \
  template<> struct register_test_file<__COUNTER__> { static void go() {} };

DECLARE_TESTS_FILES_BEGIN

DECLARE_TESTS_FILE(bbox_collision_detector_tests)
DECLARE_TESTS_FILE(borrowed_bitset_tests)
DECLARE_TESTS_FILE(bounds_checked_int_tests)
DECLARE_TESTS_FILE(misc_utils_tests)
DECLARE_TESTS_FILE(patricia_trie_tests)
DECLARE_TESTS_FILE(units_tests)

DECLARE_TESTS_FILES_END


//////////////////////////////////////////////////////////////////////////
//////// Test-registration code that uses no global constructors /////////
//////////////////////////////////////////////////////////////////////////

// The testing world is composed of test files, which are composed of test
// cases, which are composed of code and tests.  Test files are enumerated
// first-to-last in the above DECLARE_TESTS_FILES order
// via register_test_file<>'s recursion.  Within each file, test cases are
{'fraction_non_alphanumeric': 0.11662928548542134, 'fraction_numerical': 0.009291893623838513, 'mean_word_length': 3.2848318462594372, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7353164', 'n_tokens_mistral': 1875, 'n_tokens_neox': 1743, 'n_words': 699}