<commit_before>/**
 * \file    testbench.c
 * \author  <NAME> (<EMAIL>)
 * \brief   Testbench core
 * 
 */

#include "testbench.h"


extern testbench_test_t * testbench_testlist[];


/******************************************************************************/
int main(
    int     argc,
    char ** argv)
{
    testbench_test_t ** pos = testbench_testlist;
    unsigned passed, failed;
    passed = 0;
    failed = 0;
    
    while(0 != (*pos))
    {
        (*pos)->test_fcn(*pos);
        
        passed += (*pos)->passed;
        failed += (*pos)->failed;
        
        pos ++;
    }
    
    return 0;
}

/******************************************************************************/
void testbench_result(
    testbench_test_t * this_test,
    const char * test_name,
    int result
)
{
    testbench_log(test_name, result);
    
    if(result)
    {
        this_test->passed++;
    }
    else
    {
        this_test->failed++;
    }
}

/******************************************************************************/
void testbench_eq_tol(
    testbench_test_t * this_test,
    const char * test_name,
    double a,
    double b,
    double tol
)
{
    double res;
    
    /* Calculate distance */
    res = a - b;
    
    /* Log results */
    testbench_result(
        this_test,
        test_name,
        (res <= tol) && (res >= -tol)
    );    
}

/******************************************************************************/
void testbench_neq_tol(
    testbench_test_t * this_test,
    const char * test_name,
    double a,
    double b,
    double tol
)
{
    double res;
    
    /* Calculate distance */
    res = a - b;
    
    /* Log results */
    testbench_result(
        this_test,    
        test_name,
        (res > tol) || (res < -tol)
    );    
}<commit_msg>Added some comments<commit_after>/**
 * \file    testbench.c
 * \author  <NAME> (<EMAIL>)
 * \brief   Testbench core
 * 
 */

#include "testbench.h"


extern testbench_test_t * testbench_testlist[];


/******************************************************************************/
int main(
    int     argc,
    char ** argv)
{
    testbench_test_t ** pos = testbench_testlist;
    unsigned passed, failed;
    passed = 0;
    failed = 0;
    
    /* Iterate through all the tests */
    while(0 != (*pos))
    {
        /* Perform test */
        (*pos)->test_fcn(*pos);
        
        /* Count results */
        passed += (*pos)->passed;
        failed += (*pos)->failed;
        
        /* Move to another test */
        pos ++;
    }
    
    return 0;
}

/******************************************************************************/
void testbench_result(
    testbench_test_t * this_test,
    const char * test_name,
    int result
)
{
    testbench_log(test_name, result);
    
    if(result)
    {
        this_test->passed++;
    }
    else
    {
        this_test->failed++;
    }
}

/******************************************************************************/
void testbench_eq_tol(
    testbench_test_t * this_test,
    const char * test_name,
    double a,
    double b,
    double tol
)
{
    double res;
    
    /* Calculate distance */
    res = a - b;
    
    /* Log results */
    testbench_result(
        this_test,
        test_name,
        (res <= tol) && (res >= -tol)
    );    
}

/******************************************************************************/
void testbench_neq_tol(
    testbench_test_t * this_test,
    const char * test_name,
    double a,
    double b,
    double tol
)
{
    double res;
    
    /* Calculate distance */
    res = a - b;
    
    /* Log results */
    testbench_result(
        this_test,    
        test_name,
        (res > tol) || (res < -tol)
    );    
}
{'fraction_non_alphanumeric': 0.2608915906788247, 'fraction_numerical': 0.002026342451874367, 'mean_word_length': 1.8699127906976745, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '6500985', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1150, 'n_words': 241}