Testing interval trees

July 17, 2008

After implementing interval trees, I have started to think about testing them. It would be great to have some test script. To do this, I would need to think about different scenarios, that can happen – different ways of inserting and removing data can lead to different rotations, for example. Of course, I did not want to spend too much time on testing.

Therefore I have written small test program, that inserts random events into interval tree and list, does several searches, deletes some events and  does some searches again. I have found several bugs this way.

But how can I be sure, that all interesting situations were tested ? I have used great gcov and lcov tools. Almost 90% of code was covered by tests, and although the remaining code is not so important, I would like to add more tests in the future. The valgrind did not show me any memory leaks. This is my tip for your  better sleep: test your code.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: