TREES += rb
rb_LIBSRCS = rbtree.c
rb_DEFINES = -DTREE=RB
-rb_TESTS = rbtest
+rb_TESTS = rbtest rbregress
libxyla.a: $(LIBOBJS)
$(call v-tag,AR)$(AR) crs $@ $+
--- /dev/null
+
+;; `rbtree_join' could look for a sibling node's colour without checking
+;; that it actually existed.
+tree dump, ht = 1
+ #0x00000001 (n = 2) (*) 0
+ #0x00000000 (n = 1) ( ) 3
+6
+tree dump, ht = 1
+ #0x00000001 (n = 1) ( ) 0
+ #0x00000000 (n = 3) (*) 3
+ #0x00000002 (n = 1) ( ) 6
--- /dev/null
+;;; Regression testing for red-black trees.
+
+:
+:;; `rbtree_join' could look for a sibling node's colour without checking
+:;; that it actually existed.
+
+= (_ *0 (_ 3 _)) D!
+( 6k ~ D!
* ascending. \
*/ \
s = (struct rbnode *)p->_bst.left; \
- if (s->f&RBF_RED) { \
+ if (s && s->f&RBF_RED) { \
V( fprintf(stderr, "RBTREE JOIN red sibling " \
"(" #right " child): %s\n", \
path.k ? "ascend" : "extend tree"); ) \