<commit_before>#define BOOST_TEST_STATIC_LINK

#include "boost/test/unit_test.hpp"
#include "boost/random.hpp"

#include "boost/log/trivial.hpp"
#include "boost/log/utility/setup/file.hpp"
#include "boost/log/utility/setup/common_attributes.hpp"
#include "boost/log/sources/severity_logger.hpp"

#include "boost/noncopyable.hpp"

#include "fixed_point.hpp"

#include <ctime>

#include <iomanip>
#include <fstream>
#include <sstream>

#include <stdexcept>

namespace libq {
namespace unit_tests {

namespace logging = boost::log;
namespace src = boost::log::sources;
namespace sinks = boost::log::sinks;
namespace keywords = boost::log::keywords;

class logger
    :    private boost::noncopyable,
         public src::severity_logger<logging::trivial::severity_level>
{
    bool m_is_initialized;

    logger()
        : m_is_initialized(false){}

public:
    static void init(void)
    {
        logging::add_file_log(
            keywords::file_name = "precision.log",
            keywords::format = "[%TimeStamp%]: %Message%"
        );
        logging::core::get()->set_filter(
            logging::trivial::severity >= logging::trivial::info
        );
        logging::add_common_attributes();
    }

    static logger& instance()
    {
        static logger precision_logger;
        if (!precision_logger.m_is_initialized) {
            init();

            precision_logger.m_is_initialized = true;
        }

        return precision_logger;
    }
};

/*!
 \brief gets the random uniform number that is within
 the dynamic range of specified fixed-point format
*/
template<typename Q>
double r(void)
{
    static boost::mt19937 gen(std::size_t(std::time(0)));
    static boost::uniform_01<boost::mt19937> uniform(gen);

    double const low = static_cast<double>(std::numeric_limits<Q>::min());
    double const high = static_cast<double>(std::numeric_limits<Q>::max());

    return low + uniform() * (high - low);
}

BOOST_AUTO_TEST_SUITE(Precision)

#define ITERATIONS 100
#define Q(n,f) libq::Q<n, f>
#define UQ(n, f) libq::UQ<n, f>
#define TEST_THE_PRECISION_OF2(Q1, Q2, OP, error_limit) \
    for (std::size_t it = 0; it != ITERATIONS; ++it) { \
        double const u1 = r<Q1>(); \<commit_msg>[CODE-REVIEW] [TESTS] multi-file logger<commit_after>#define BOOST_TEST_STATIC_LINK

#include "boost/test/unit_test.hpp"
#include "boost/random.hpp"

#include "boost/log/trivial.hpp"
#include "boost/log/utility/setup/file.hpp"
#include "boost/log/utility/setup/common_attributes.hpp"
#include "boost/log/sources/severity_logger.hpp"

#include "boost/noncopyable.hpp"

#include "fixed_point.hpp"

#include <ctime>

#include <iomanip>
#include <fstream>
#include <sstream>

#include <stdexcept>

namespace libq {
namespace unit_tests {

namespace logging = boost::log;
namespace src = boost::log::sources;
namespace sinks = boost::log::sinks;
namespace keywords = boost::log::keywords;

class logger
    :    public src::severity_logger<logging::trivial::severity_level>
{
public:
    logger(std::string const& _log_filename)
    {
        logging::add_file_log(
            keywords::file_name = _log_filename,
            keywords::format = "[%TimeStamp%]: %Message%"
        );
        logging::core::get()->set_filter(
            logging::trivial::severity >= logging::trivial::info
        );
        logging::add_common_attributes();
    }
};

/*!
 \brief gets the random uniform number that is within
 the dynamic range of specified fixed-point format
*/
template<typename Q>
double r(void)
{
    static boost::mt19937 gen(std::size_t(std::time(0)));
    static boost::uniform_01<boost::mt19937> uniform(gen);

    double const low = static_cast<double>(std::numeric_limits<Q>::min());
    double const high = static_cast<double>(std::numeric_limits<Q>::max());

    return low + uniform() * (high - low);
}

BOOST_AUTO_TEST_SUITE(Precision)

#define ITERATIONS 100
#define Q(n,f) libq::Q<n, f>
#define UQ(n, f) libq::UQ<n, f>
#define TEST_THE_PRECISION_OF2(Q1, Q2, OP, error_limit) \
    for (std::size_t it = 0; it != ITERATIONS; ++it) { \
        double const u1 = r<Q1>(); \
{'fraction_non_alphanumeric': 0.14463718543855364, 'fraction_numerical': 0.010750061079892499, 'mean_word_length': 4.054320987654321, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 37, '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': '2241120', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1352, 'n_words': 282}