]> git.ipfire.org Git - thirdparty/git.git/blobdiff - test-treap.c
git-tag.txt: list all modes in the description
[thirdparty/git.git] / test-treap.c
index cdba5111e19cd850f262108a330ce5d4ce63a166..ab8c951c6eb39f54a9885dd15c173f974d7357d5 100644 (file)
@@ -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));