| www.delorie.com/gnu/docs/avl/libavl_82.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Testing for overflow requires an entirely different set of test functions. The idea is to create a too-tall tree using one of the pathological insertion orders (ascending, descending, zig-zag, shifted ascending), then try out each of the functions that can overflow on it and make sure that they behave as they should.
There is a separate test function for each function that can overflow a stack but which is not tested by test(). These functions are called by driver function test_overflow(), which also takes care of creating, populating, and destroying the tree.
int test_overflow (struct libavl_allocator *, int order[], int n, |
There is an overflow tester for almost every function that can overflow. Here is one example:
Exercises:
1. Write the rest of the overflow tester functions. (The test_overflow() function lists all of them.) [answer]
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |