+insert_node (struct abt *abt, struct element *insert,
+ enum insertion_method method)
+{
+ if (method == INSERT)
+ check (abt_insert (abt, &insert->node) == NULL);
+ else
+ {
+ struct abt_node *p = abt->root;
+ int dir = 0;
+ if (p != NULL)
+ for (;;)
+ {
+ dir = insert->data > abt_node_to_element (p)->data;
+ if (p->down[dir] == NULL)
+ break;
+ p = p->down[dir];
+ }
+ if (method == INSERT_AFTER)
+ {
+ if (p != NULL && (dir != 1 || p->down[1] != NULL))
+ p = abt_prev (abt, p);
+ abt_insert_after (abt, p, &insert->node);
+ }
+ else
+ {
+ if (p != NULL && (dir != 0 || p->down[0] != NULL))
+ p = abt_next (abt, p);
+ abt_insert_before (abt, p, &insert->node);
+ }
+ }
+}
+
+
+/* Inserts the N values from 0 to N - 1 (inclusive) into an
+ ABT in the order specified by INSERTIONS using the given
+ METHOD, then deletes them in the order specified by DELETIONS,
+ checking the ABT's contents for correctness after each
+ operation. */
+static void
+do_test_insert_delete (enum insertion_method method,
+ const int insertions[],
+ const int deletions[],
+ size_t n)