diff options
Diffstat (limited to 'lib/rbtree_test.c')
-rw-r--r-- | lib/rbtree_test.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c index df6c125ff5c2..8b3c9dc88262 100644 --- a/lib/rbtree_test.c +++ b/lib/rbtree_test.c | |||
@@ -114,6 +114,16 @@ static int black_path_count(struct rb_node *rb) | |||
114 | return count; | 114 | return count; |
115 | } | 115 | } |
116 | 116 | ||
117 | static void check_postorder_foreach(int nr_nodes) | ||
118 | { | ||
119 | struct test_node *cur, *n; | ||
120 | int count = 0; | ||
121 | rbtree_postorder_for_each_entry_safe(cur, n, &root, rb) | ||
122 | count++; | ||
123 | |||
124 | WARN_ON_ONCE(count != nr_nodes); | ||
125 | } | ||
126 | |||
117 | static void check_postorder(int nr_nodes) | 127 | static void check_postorder(int nr_nodes) |
118 | { | 128 | { |
119 | struct rb_node *rb; | 129 | struct rb_node *rb; |
@@ -148,6 +158,7 @@ static void check(int nr_nodes) | |||
148 | WARN_ON_ONCE(count < (1 << black_path_count(rb_last(&root))) - 1); | 158 | WARN_ON_ONCE(count < (1 << black_path_count(rb_last(&root))) - 1); |
149 | 159 | ||
150 | check_postorder(nr_nodes); | 160 | check_postorder(nr_nodes); |
161 | check_postorder_foreach(nr_nodes); | ||
151 | } | 162 | } |
152 | 163 | ||
153 | static void check_augmented(int nr_nodes) | 164 | static void check_augmented(int nr_nodes) |