<commit_before>#include "minunit.h"
#include <register.h>

FILE *LOG_FILE = NULL;

char *test_Register_init() 
{
    Register_init();

    return NULL;
}

char *test_Register_connect_disconnect()
{
    Register_connect(12, CONN_TYPE_MSG);
    mu_assert(Register_exists(12) == CONN_TYPE_MSG, "Didn't register.");

    Register_disconnect(12);
    mu_assert(Register_exists(12) == 0, "Didn't disconnect.");

    return NULL;
}

char *test_Register_ping()
{
    Register_connect(12232, CONN_TYPE_HTTP);
    mu_assert(Register_exists(12232) == CONN_TYPE_HTTP, "Didn't register.");

    mu_assert(Register_ping(12232), "Ping didn't work.");

    Register_disconnect(12232);
    mu_assert(Register_exists(12) == 0, "Didn't disconnect.");

    return NULL;
}


char * all_tests() {
    mu_suite_start();

    mu_run_test(test_Register_init);
    mu_run_test(test_Register_connect_disconnect);
    mu_run_test(test_Register_ping);

    return NULL;
}
<commit_msg>More coverage on register tests.<commit_after>#include "minunit.h"
#include <register.h>

FILE *LOG_FILE = NULL;

char *test_Register_init() 
{
    Register_init();

    // make sure we can call it twice
    
    Register_init();

    return NULL;
}

char *test_Register_connect_disconnect()
{
    Register_connect(12, CONN_TYPE_MSG);
    mu_assert(Register_exists(12) == CONN_TYPE_MSG, "Didn't register.");

    Register_disconnect(12);
    mu_assert(Register_exists(12) == 0, "Didn't disconnect.");

    // do it again to make sure we log invalid unregisters
    Register_disconnect(12);
    return NULL;
}

char *test_Register_ping()
{
    Register_connect(12232, CONN_TYPE_HTTP);
    mu_assert(Register_exists(12232) == CONN_TYPE_HTTP, "Didn't register.");

    mu_assert(Register_ping(12232), "Ping didn't work.");

    // attempt a double registration which should work
    Register_connect(12232, CONN_TYPE_MSG);
    mu_assert(Register_exists(12232) == CONN_TYPE_MSG, "Didn't register.");

    Register_disconnect(12232);
    mu_assert(Register_exists(12) == 0, "Didn't disconnect.");

    return NULL;
}


char * all_tests() {
    mu_suite_start();

    mu_run_test(test_Register_init);
    mu_run_test(test_Register_connect_disconnect);
    mu_run_test(test_Register_ping);

    return NULL;
}

{'fraction_non_alphanumeric': 0.12356067316209035, 'fraction_numerical': 0.03365810451727192, 'mean_word_length': 4.536764705882353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1036219', 'n_tokens_mistral': 852, 'n_tokens_neox': 762, 'n_words': 144}