diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-11-27 14:05:25 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-11-27 14:05:25 -0500 |
commit | 4d71f70fd1cd0e11d9698e52411cd55045044c34 (patch) | |
tree | 9206590ee711702157e7255ebfb03da4ae2363e5 /shape.c | |
parent | 872922b03d9be2a4d861c5eb8190be24498e3e9d (diff) | |
download | ruby-4d71f70fd1cd0e11d9698e52411cd55045044c34.tar.gz |
Add assertions to check created red-black tree
Diffstat (limited to 'shape.c')
-rw-r--r-- | shape.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -409,6 +409,14 @@ redblack_cache_ancestors(rb_shape_t * shape) if (shape->type == SHAPE_IVAR) { shape->ancestor_index = redblack_insert(parent_index, shape->edge_name, shape); + +#if RUBY_DEBUG + if (shape->ancestor_index) { + redblack_node_t *inserted_node = redblack_find(shape->ancestor_index, shape->edge_name); + RUBY_ASSERT(inserted_node); + RUBY_ASSERT(redblack_value(inserted_node) == shape); + } +#endif } else { shape->ancestor_index = parent_index; |