<commit_before>#include "../ptrie.h"

extern NODE *root;

#define TRIAL_NUM   3

int main(int argc, char *argv[])
{
    int status, i;
    ENTRY *en[TRIAL_NUM];
    ENTRY *result;
    
    KEY key1[] = "academe";
    KEY key2[] = "cache";
    KEY key3[] = "cable";

    DATA val1, val2, val3;
    
    val1 = 10;
    val2 = 20;
    val3 = 30;
 
    en[0] = createENTRY(key1, val1, CREATED);
    en[1] = createENTRY(key2, val2, CREATED);
    en[2] = createENTRY(key3, val3, CREATED);
 
    for(i = 0; i < TRIAL_NUM; i++) {
        status = insert(en[i]);        
        if (status == FAILURE) {
            printf("FAILURE@insert():%d\n", i);
            break;
        }
        else {
            printf("insert of [%s] completed.\n", en[i]->key);
            continue;
        }

    }

    for(i = 0; i < TRIAL_NUM; i++) {
        result = search(root, en[i]->key);
        if (result == NULL) {
            printf("FAILURE key[%d]:%s@search()", i, en[i]->key);
        }
        else {
            printf("result->key:%s result->val:%u result->status:%d\n",
                                    result->key, result->val, result->status);
            putchar('\n');
        }
    }



    for(i = 0; i < TRIAL_NUM; i++) {
        free(en[i]->key);
        free(en[i]);
    }

    free(root);
                
    return 0;
    
}
<commit_msg>test_insert.c How to use  insert() and delete()<commit_after>#include "../ptrie.h"

extern NODE *root;

#define TRIAL_NUM   3

int main(int argc, char *argv[])
{
    int status, i;
    ENTRY *en[TRIAL_NUM];
    ENTRY *result;
    
    KEY *key[TRIAL_NUM] = {"academe", "cable", "cache"};

    DATA val[TRIAL_NUM] = {10, 20, 30};
    
    for(i = 0; i < TRIAL_NUM; i++) {
        en[i] = createENTRY(key[i], val[i], CREATED);
    }
 
    for(i = 0; i < TRIAL_NUM; i++) {
        status = insert(en[i]);        
        if (status == SUCCESS) {
            printf("insert of [%s] completed.\n", en[i]->key);
            continue;
        }
        else if (status == FAILURE) {
            printf("FAILURE@insert():%d\n", i);
            break;
        }
        else {
            printf("Unknown Error@insert():%d\n", i);
        }
    }

    for(i = 0; i < TRIAL_NUM; i++) {
        result = search(root, en[i]->key);
        if (result == NULL) {
            printf("FAILURE key[%d]:%s@search()", i, en[i]->key);
        }
        else {
            printf("result->key:%s result->val:%u result->status:%d\n",
                                    result->key, result->val, result->status);
            putchar('\n');
        }
    }

    
    for(i = 0; i < TRIAL_NUM; i++) {
        status = delete(&root, root, en[i]->key);
        if (status == DELETED || MATCHED) {
            printf("delete of [%s] completed.\n", en[i]->key);
            continue;
        }
        else if (status == ERROR) {
            printf("FAILURE@delete():%s\n", en[i]->key);
            break;
        }
        else {
            printf("Unknown Error@delete():%s status:%d\n", en[i]->key, status);
            break;
        }
    }
    
    for(i = 0; i < TRIAL_NUM; i++) {
        free(en[i]->key);
        free(en[i]);
    }

    return 0;
    
}

{'fraction_non_alphanumeric': 0.18233259981138006, 'fraction_numerical': 0.013203395158755108, 'mean_word_length': 1.6081967213114754, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7086485', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1104, 'n_words': 241}