1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 06:41:53 +02:00
wernermisc/qpkg/rbtest.c
2010-11-19 19:33:05 -03:00

38 lines
555 B
C

#include <stdio.h>
#include <string.h>
#include "jrb.h"
static int cmp(Jval a, Jval b)
{
return strcmp(jval_v(a), jval_v(b));
}
#define INSERT(key, val) \
jrb_insert_gen(tree, new_jval_v(key), new_jval_v(val), cmp)
int main(void)
{
JRB tree = make_jrb();
JRB p;
INSERT("ab", "have");
INSERT("d", "little");
INSERT("c", "this");
INSERT("b", "passed");
INSERT("e", "regression");
INSERT("fa", "test");
INSERT("aa", "We");
INSERT("ff", "!");
jrb_traverse(p, tree)
printf("%s ", (char *) jval_v(p->val));
printf("\n");
return 0;
}