Skip to content

Commit

Permalink
put random bits into the info field
Browse files Browse the repository at this point in the history
  • Loading branch information
regehr committed Feb 14, 2013
1 parent b4942d2 commit 9d49975
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fuzz_red_black_tree.c
Expand Up @@ -3,6 +3,7 @@
#include<ctype.h>
#include <assert.h>
#include <time.h>
#include <stdint.h>
#include "container.h"

#define META_REPS 1000
Expand Down Expand Up @@ -42,6 +43,17 @@ int randomInt (void)
return rand()%FUZZ_RANGE;
}

void *randomVoidP (void)
{
uintptr_t p = 0;
int i;
for (i=0; i<sizeof(p); i++) {
p <<= 8;
p += rand()%256;
}
return (void *)p;
}

int idx;

void InorderTreeVerify(rb_red_blk_tree* tree, rb_red_blk_node* x) {
Expand Down Expand Up @@ -104,7 +116,7 @@ static void fuzzit (void)

newInt=(int*) malloc(sizeof(int));
*newInt=newKey;
RBTreeInsert(tree,newInt,0);
RBTreeInsert(tree,newInt,randomVoidP());
containerInsert(newKey);
}
break;
Expand Down

0 comments on commit 9d49975

Please sign in to comment.