view src/llrb/verifier/verify_put_cs.c @ 195:119c035e0e36

replace Array and Stack for array and stack
author ikkun
date Fri, 16 Dec 2016 23:27:14 +0900
parents 3d7ecced7e14
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);
}