view src/llrb/verifier/verify_put_cs.c @ 100:3d7ecced7e14

Split functions which gets tree height
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Tue, 02 Feb 2016 16:12:34 +0900
parents ca55f4be5f0f
children
line wrap: on
line source

/* Verification of LLRB-Tree height in put operations.
 * LLRB-Tree allows (max-height) <= 2*(min-height).
 */

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "llrbContextWithVerifier.h"

__code meta(struct Context* context, enum Code next) {
    if (next == Put) {
        verify_tree_height(context->data[Tree]->tree.root);
    }
    goto (context->code[next])(context);
}

__code start_code(struct Context* context, enum Code next) {
    unsigned int seed = (unsigned int)time(NULL);

    printf("--- srand(%u)\n", seed);
    goto meta(context, next);
}

__code exit_code(struct Context* context) {
    free(context->code);
    free(context->data);
    free(context->heapStart);
    goto exit(0);
}