<commit_before>#ifndef _GHOST_TEST_H
#define _GHOST_TEST_H

#include <math.h>


#define D_EPS 1.e-14
#define S_EPS 1.e-6

#define RETURN_IF_DIFFER(a,b,f,t) \
        if (t & GHOST_DT_REAL) {\
            if (t & GHOST_DT_DOUBLE) {\
                if (fabs(*((double *)a) - *((double *)b)) > D_EPS*f) {\
                    return EXIT_FAILURE;\
                }\
            } else {\
                if (fabsf(*((float *)a) - *((float *)b)) > S_EPS*f) {\
                    return EXIT_FAILURE;\
                }\
            }\
        } else {\
            if (t & GHOST_DT_DOUBLE) {\
                if (fabs((*(ghost_complex<double> *)a).re - (*(ghost_complex<double> *)b).re) > D_EPS*f) {\
                    return EXIT_FAILURE;\
                }\
                if (fabs((*(ghost_complex<double> *)a).im - (*(ghost_complex<double> *)b).im) > D_EPS*f) {\
                    return EXIT_FAILURE;\
                }\
            } else {\
                if (fabsf((*(ghost_complex<float> *)a).re - (*(ghost_complex<float> *)b).re) > S_EPS*f) {\
                    return EXIT_FAILURE;\
                }\
                if (fabsf((*(ghost_complex<float> *)a).im - (*(ghost_complex<float> *)b).im) > S_EPS*f) {\
                    return EXIT_FAILURE;\
                }\
            }\
        }\


#define GHOST_TEST_CALL(call) {if (call != GHOST_SUCCESS) {return EXIT_FAILURE;}}


#endif<commit_msg>Actually print an error when values differ in the "simple" test<commit_after>#ifndef _GHOST_TEST_H
#define _GHOST_TEST_H

#include <math.h>


#define D_EPS 1.e-14
#define S_EPS 1.e-6

#define RETURN_IF_DIFFER(a,b,f,t) \
        if (t & GHOST_DT_REAL) {\
            if (t & GHOST_DT_DOUBLE) {\
                double return_if_differ_err = fabs(*((double *)a) - *((double *)b));\
                if (return_if_differ_err > D_EPS*f) {\
                    ERROR_LOG("Values differ: error %8.4e > %8.4e", return_if_differ_err, D_EPS*f);\
                    return EXIT_FAILURE;\
                }\
            } else {\
                float return_if_differ_err = fabs(*((float *)a) - *((float *)b));\
                if (return_if_differ_err > S_EPS*f) {\
                    ERROR_LOG("Values differ: error %8.4e > %8.4e", return_if_differ_err, S_EPS*f);\
                    return EXIT_FAILURE;\
                }\
            }\
        } else {\
            if (t & GHOST_DT_DOUBLE) {\
                double return_if_differ_err = fabs((*(ghost_complex<double> *)a).re - (*(ghost_complex<double> *)b).re);\
                if (return_if_differ_err > D_EPS*f) {\
                    ERROR_LOG("Values differ: real part error %8.4e > %8.4e", return_if_differ_err, D_EPS*f);\
                    return EXIT_FAILURE;\
                }\
                return_if_differ_err = fabs((*(ghost_complex<double> *)a).im - (*(ghost_complex<double> *)b).im);\
                if (return_if_differ_err > D_EPS*f) {\
                    ERROR_LOG("Values differ: imag part error %8.4e > %8.4e", return_if_differ_err, D_EPS*f);\
                    return EXIT_FAILURE;\
                }\
            } else {\
                float return_if_differ_err = fabs((*(ghost_complex<float> *)a).re - (*(ghost_complex<float> *)b).re);\
                if (return_if_differ_err > D_EPS*f) {\
                    ERROR_LOG("Values differ: real part error %8.4e > %8.4e", return_if_differ_err, D_EPS*f);\
                    return EXIT_FAILURE;\
                }\
                return_if_differ_err = fabs((*(ghost_complex<float> *)a).im - (*(ghost_complex<float> *)b).im);\
                if (return_if_differ_err > D_EPS*f) {\
                    ERROR_LOG("Values differ: imag part error %8.4e > %8.4e", return_if_differ_err, D_EPS*f);\
                    return EXIT_FAILURE;\
                }\
            }\
        }\


#define GHOST_TEST_CALL(call) {if (call != GHOST_SUCCESS) {return EXIT_FAILURE;}}


#endif
{'fraction_non_alphanumeric': 0.1497326203208556, 'fraction_numerical': 0.008658008658008658, 'mean_word_length': 1.620413609072715, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 39, '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': '4778502', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1345, 'n_words': 239}