Subject: Re: [boost] doxygen doc / STL container unit test
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2009-09-11 14:16:20
2009/9/11 Stefan Strasser <strasser_at_[hidden]>:
> I have two questions regarding boost library development:
> boost implements quite a few STL containers. is there a unit test that can
> test my STL container for conformity?
> say, I have a container that models the concept of a std::list, I'd like to
> change a typedef to my type, run the test and know that it behaves like
> advertised. Does anything like that already exist?
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.
Along with the development of my own library I
wrote a test tool that implements a law based testing
which might be interesting in this respect.
I called the tool a 'Law Based Test Automaton' (LaBatea).
It is a generic tool that allows to define Laws
(also known as axioms ala c++0x or semantical requirements
or semantical invariants), to generate law instances
and to report law violations, if such violations are found.
A concept to be tested can be defined as a set of laws.
Once a law or a set of laws is defined, it can be validated
for a given type. There is one additional requirement though:
A generator that randomly generates test data has to
be implemented for every type to be validated.
As already mentioned I developed LaBatea as a test
tool for the Interval Template Library. The first application
of the tool to code other than my own was Lukes
The tool certainly has some shortcomings at the present
(1) The system of date generators should be more
(2) Running large sets of laws (concepts) with different
instance types for their template parameters -- which is
the final goal -- leads to test programs that do compile quite
If you are interested in LaBatea you find the code at
I am sorry there is virtually no documentation on LaBatea.
But the latest example on boost.polygon contains
some helpful comments.
LaBatea compiles fastest on msvc-9. I also tested
successfully with gcc-4.3.2. LaBatea does not compile with
gcc-4.1.0 and older.