X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=test-treap.c;h=ab8c951c6eb39f54a9885dd15c173f974d7357d5;hb=70ec8687a66eb7d3b273d9a7996fab309d2b0974;hp=cdba5111e19cd850f262108a330ce5d4ce63a166;hpb=e6202dfe0021e2662eb4e19e6d01e33081608b5e;p=thirdparty%2Fgit.git diff --git a/test-treap.c b/test-treap.c index cdba5111e1..ab8c951c6e 100644 --- a/test-treap.c +++ b/test-treap.c @@ -38,9 +38,14 @@ int main(int argc, char *argv[]) usage("test-treap < ints"); while (strbuf_getline(&sb, stdin, '\n') != EOF) { - item = node_alloc(1); - strtonode(node_pointer(item), sb.buf); - treap_insert(&root, node_pointer(item)); + struct int_node *node = node_pointer(node_alloc(1)); + + item = node_offset(node); + strtonode(node, sb.buf); + node = treap_insert(&root, node_pointer(item)); + if (node_offset(node) != item) + die("inserted %"PRIu32" in place of %"PRIu32"", + node_offset(node), item); } item = node_offset(treap_first(&root));