
This question is definitely a good one. Because it
immediately reveals two important points about testing:
(1) Tests should be reusable (2) Tests should be structured along concepts
as concepts are composable and refinable, also the concept tests should be composable and refinable.
I did not research if there are efforts at boost to support such kind of concept based testing. But I think the usefulness of such a framework is obvious.
I committed something similar for the BGL test suite (test_graph.cpp, I think in trunk). It's not nearly as formal and primarily just exercises the Graph concept interfaces. Mostly it's just a framework for sanity testing a graph adaptor or data structure. Also virtually no documentation. One of the things that I found was that generically testing data structures requires a fairly complete set of type traits and metafunctions that query types based on their concepts. I'm using these to extensively tag dispatch some of the test methods. It seems like a good approach, but it's not easy to write. Andrew Sutton andrew.n.sutton@gmail.com