diff options
Diffstat (limited to 'lib/rbtree_test.c')
-rw-r--r-- | lib/rbtree_test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c index 122f02f9941b..31dd4ccd3baa 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(int nr_nodes) | ||
118 | { | ||
119 | struct rb_node *rb; | ||
120 | int count = 0; | ||
121 | for (rb = rb_first_postorder(&root); rb; rb = rb_next_postorder(rb)) | ||
122 | count++; | ||
123 | |||
124 | WARN_ON_ONCE(count != nr_nodes); | ||
125 | } | ||
126 | |||
117 | static void check(int nr_nodes) | 127 | static void check(int nr_nodes) |
118 | { | 128 | { |
119 | struct rb_node *rb; | 129 | struct rb_node *rb; |
@@ -136,6 +146,8 @@ static void check(int nr_nodes) | |||
136 | 146 | ||
137 | WARN_ON_ONCE(count != nr_nodes); | 147 | WARN_ON_ONCE(count != nr_nodes); |
138 | WARN_ON_ONCE(count < (1 << black_path_count(rb_last(&root))) - 1); | 148 | WARN_ON_ONCE(count < (1 << black_path_count(rb_last(&root))) - 1); |
149 | |||
150 | check_postorder(nr_nodes); | ||
139 | } | 151 | } |
140 | 152 | ||
141 | static void check_augmented(int nr_nodes) | 153 | static void check_augmented(int nr_nodes) |