<commit_before>#ifndef _UNIT_TEST__H_78eda8e4_a367_427c_bc4a_0048a7a3dfd1
#define _UNIT_TEST__H_78eda8e4_a367_427c_bc4a_0048a7a3dfd1

#include <vector>
#include <deque>
#include <iostream>
#include <iterator>
#include <iomanip>
#include <memory>
#include <chrono>
#include <ctime>
#include <sstream>
#include <string>
#include <typeinfo>
#include <functional>
#include <map>
#include <set>
#include <thread>
#include <mutex>
#include <cstdint>
#include <signal.h> 
#include <op/utest/unit_test_is.h>

/** Allows place usefull information to detail output.
* Usage:
* \code
* ...
* OP_CODE_DETAILS() << "Detail of exception with number " << 57;

* \endcode
*/
#define OP_CODE_DETAILS(...) OP::utest::detail() << "{File:" << __FILE__ << " at:" << __LINE__  << "}\n" ## __VA_ARGS__ 
#define OP_TEST_STRINGIFY(a) #a

/** Exposes assert functionality if for some reason function have no access to TestResult instance.
* Usage:
* \code
* ...
*   OP_UTEST_ASSERT(1==0, << "Logic is a power! Following number:" << 57);
*/
#define OP_UTEST_ASSERT(condition, ...) (void)((!!(condition)) || OP::utest::_inner::_uncondition_exception_raise( (OP_CODE_DETAILS( << OP_TEST_STRINGIFY(condition) << " - " ## __VA_ARGS__ )).result() ) )
/**The same as OP_UTEST_ASSERT but unconditionally failed*/
#define OP_UTEST_FAIL(...) (void)(OP::utest::_inner::_uncondition_exception_raise( (OP_CODE_DETAILS( << OP_TEST_STRINGIFY(condition) << " - " ## __VA_ARGS__ )).result() ) )
namespace OP
{
    namespace utest
    {
        
        struct TestFail;
        /**
        *   Level of result logging
        */
        enum class ResultLevel
        {
            /**Display errors only*/
            error = 1,
            /**Display information messages and errors*/
            info = 2,
            /**Display all messages*/
            debug = 3
        };

        namespace _inner {

            template <class X>
            inline bool _uncondition_exception_raise(X&&x)
            {
                throw OP::utest::TestFail(std::forward<X>(x));
            }
            template <class F, class ... Args >
            inline std::function< F(Args...) > make_function(F&& f)
            {
                return std::forward<F>(f);
            }

            inline std::function< void() > make_function(void f())
            {
                return std::function< void() >(f);
            }
            /**
            *
            *   @copyright teebuf and teestream
            *       idea and implementation copied from article http://wordaligned.org/articles/cpp-streambufs where sources are distributed
            *       over public domain
            */
            class multiplex_buf : public std::streambuf
            {
            public:

                multiplex_buf()
                {
                }

                /**
                * Bind some stream-buffer to multiplexor
                */
                void bind(std::streambuf * sb)
                {
                    _buffers.emplace_back(sb);
                }
                /**
                *   Remove previously #bind stream-buf from this multiplexor<commit_msg>Compile time clang compatibility issues<commit_after>#ifndef _UNIT_TEST__H_78eda8e4_a367_427c_bc4a_0048a7a3dfd1
#define _UNIT_TEST__H_78eda8e4_a367_427c_bc4a_0048a7a3dfd1

#include <vector>
#include <deque>
#include <iostream>
#include <iterator>
#include <iomanip>
#include <memory>
#include <chrono>
#include <ctime>
#include <sstream>
#include <string>
#include <typeinfo>
#include <functional>
#include <map>
#include <set>
#include <thread>
#include <mutex>
#include <cstdint>
#include <signal.h> 
#include <op/utest/unit_test_is.h>

/** Allows place usefull information to detail output.
* Usage:
* \code
* ...
* OP_CODE_DETAILS() << "Detail of exception with number " << 57;

* \endcode
*/
#define OP_CODE_DETAILS(...) OP::utest::detail() << "{File:" << __FILE__ << " at:" << __LINE__  << "}\n" ## __VA_ARGS__ 
#define OP_TEST_STRINGIFY(a) #a

/** Exposes assert functionality if for some reason function have no access to TestResult instance.
* Usage:
* \code
* ...
*   OP_UTEST_ASSERT(1==0, << "Logic is a power! Following number:" << 57);
*/
#define OP_UTEST_ASSERT(condition, ...) ([](bool test)->void{ \
        if(!test){ OP::utest::_inner::_uncondition_exception_raise( (OP_CODE_DETAILS( << OP_TEST_STRINGIFY(condition) << " - " ## __VA_ARGS__ )).result() ); } \
    }(condition))

/**The same as OP_UTEST_ASSERT but unconditionally failed*/
#define OP_UTEST_FAIL(...) (void)(OP::utest::_inner::_uncondition_exception_raise( (OP_CODE_DETAILS( << OP_TEST_STRINGIFY(condition) << " - " ## __VA_ARGS__ )).result() ) )
namespace OP
{
    namespace utest
    {
        
        struct TestFail;
        /**
        *   Level of result logging
        */
        enum class ResultLevel
        {
            /**Display errors only*/
            error = 1,
            /**Display information messages and errors*/
            info = 2,
            /**Display all messages*/
            debug = 3
        };

        namespace _inner {

            template <class X>
            inline bool _uncondition_exception_raise(X&&x)
            {
                throw OP::utest::TestFail(std::forward<X>(x));
            }

            /*
            template <class F, class ... Args >
            inline std::function< F(Args...) > make_function(F&& f)
            {
                return std::forward<F>(f);
            }

            inline std::function< void() > make_function(void f())
            {
                return std::function< void() >(f);
            } */
            /**
            *
            *   @copyright teebuf and teestream
            *       idea and implementation copied from article http://wordaligned.org/articles/cpp-streambufs where sources are distributed
            *       over public domain
            */
            class multiplex_buf : public std::streambuf
            {
            public:

                multiplex_buf()
                {
                }

                /**
                * Bind some stream-buffer to multiplexor
                */
                void bind(std::streambuf * sb)
                {
                    _buffers.emplace_back(sb);
                }
                /**
                *   Remove previously #bind stream-buf from this multiplexor
{'fraction_non_alphanumeric': 0.12695924764890282, 'fraction_numerical': 0.014106583072100314, 'mean_word_length': 2.0270398481973433, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 56, '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': '7216234', 'n_tokens_mistral': 1979, 'n_tokens_neox': 1887, 'n_words': 442}