I'm not sure what you need, but if you want to provide common interfaces for various data structures that can then be implemented and / or specialized in different ways, I don’t see how you could write tests for any specific one that does not exist yet.
You can write tests for a common interface to ensure that all implementations conform to the contract specified by that interface. For instance. all implementations of a sorted tree must properly order their elements, etc. As a side note, this will not actually be a unit test, but rather a test / acceptance test.
For red-black trees, you can write a set of additional (optional) tests to make sure that the tree is properly ordered after insertion and deletion. This can and should be tested through an open interface. For instance. add a series of elements to the tree so that the tree is unbalanced without reordering, and then check the tree structure to make sure it is reordered correctly.
source share