MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _check_bst_after

Function _check_bst_after

examples/test/avl.c:212–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212static int _check_bst_after(struct rt_aspace *aspace, struct rt_varea *varea, int isdel)
213{
214 rt_varea_t root = VAREA_ENTRY(aspace->tree.tree.root_node);
215 int height = _is_balanced(root);
216
217 if (root)
218 RT_ASSERT(height);
219
220 int prev_count = _count;
221 _start = 0;
222 _boundary = 0;
223 _count = 0;
224 _aspace_traversal(aspace, _check_asc_after, isdel ? NULL : varea);
225 _count = isdel ? _count : _count + 1;
226
227 if (isdel)
228 {
229 RT_ASSERT(prev_count - 1 == _count);
230 }
231 else
232 {
233 RT_ASSERT(prev_count + 1 == _count);
234 }
235
236 return 1;
237}
238
239/* test library */
240#define RANDOM(n) (xrand() % (n))

Callers 2

_aspace_bst_insertFunction · 0.85
_aspace_bst_removeFunction · 0.85

Calls 2

_is_balancedFunction · 0.85
_aspace_traversalFunction · 0.85

Tested by

no test coverage detected