<commit_before>/* We are going to test whether we can insert and delete. */

#include "test.h"

int main(int argc, const char *argv[]) {
    int r;
    toku_range_tree *tree;
    toku_range range;
    int nums[8] = {0,1,2,3,4,5,6,7};
    char letters[2] = {'A','B'};


    parse_args(argc, argv);

    /* Test overlap case */
    /*
        1   2   3   4   5   6   7
        |-------A-------|
            |-------A-------|
                |-------A-------|
            |-------B-------|
    */
    r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, malloc, free, realloc);
    CKERR(r);

    /* Verify we can insert a trivial range and lose it. */
    range.left = &nums[1];
    range.right = &nums[1];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);
    r = toku_rt_delete(tree, &range);   CKERR(r);

    range.left = &nums[1];
    range.right = &nums[5];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);

    /* Try and fail to insert exact same thing. */
    r = toku_rt_insert(tree, &range);   CKERR2(r,EDOM);

    /* Try and succeed to insert (and delete) similar yet different things */
    range.right = &nums[6];
    r = toku_rt_insert(tree, &range);   CKERR(r);
    r = toku_rt_delete(tree, &range);   CKERR(r);
    range.right = &nums[5];
    range.data = &letters[1];
    r = toku_rt_insert(tree, &range);   CKERR(r);
    r = toku_rt_delete(tree, &range);   CKERR(r);
    range.data = &letters[0];

    range.left = &nums[2];
    range.right = &nums[6];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);

    range.left = &nums[3];
    range.right = &nums[7];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);<commit_msg>Addresses #288 Added test of get_size to get code coverage again to 100%<commit_after>/* We are going to test whether we can insert and delete. */

#include "test.h"

int main(int argc, const char *argv[]) {
    int r;
    toku_range_tree *tree;
    toku_range range;
    int nums[8] = {0,1,2,3,4,5,6,7};
    char letters[2] = {'A','B'};


    parse_args(argc, argv);

    /* Test overlap case */
    /*
        1   2   3   4   5   6   7
        |-------A-------|
            |-------A-------|
                |-------A-------|
            |-------B-------|
    */
    r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, malloc, free, realloc);
    CKERR(r);

    /* Verify we can insert a trivial range and lose it. */
    range.left = &nums[1];
    range.right = &nums[1];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);
    u_int32_t num_in_range = toku_rt_get_size(tree);
    assert(num_in_range == 1);
    r = toku_rt_delete(tree, &range);   CKERR(r);

    range.left = &nums[1];
    range.right = &nums[5];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);

    /* Try and fail to insert exact same thing. */
    r = toku_rt_insert(tree, &range);   CKERR2(r,EDOM);

    /* Try and succeed to insert (and delete) similar yet different things */
    range.right = &nums[6];
    r = toku_rt_insert(tree, &range);   CKERR(r);
    r = toku_rt_delete(tree, &range);   CKERR(r);
    range.right = &nums[5];
    range.data = &letters[1];
    r = toku_rt_insert(tree, &range);   CKERR(r);
    r = toku_rt_delete(tree, &range);   CKERR(r);
    range.data = &letters[0];

    range.left = &nums[2];
    range.right = &nums[6];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);

    range.left = &nums[3];
    range.right = &nums[7];
    range.data = &letters[0];
    r = toku_rt_insert(tree, &range);   CKERR(r);
{'fraction_non_alphanumeric': 0.18915959485354503, 'fraction_numerical': 0.02107856556255133, 'mean_word_length': 2.268336314847943, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7581279', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1392, 'n_words': 332}