|
Boost : |
From: jpanzer_at_[hidden]
Date: 2001-07-03 15:11:34
Are there any unit tests for functors in the works for the Boost test
library? Specifically, to test whether they really meet complex
requirements, such as strict weak ordering, for a given set of inputs?
This is something that static concept checking clearly can't do, but
it's important to get right, and I think it's expensive or impossible
for library code to try to validate such requirements.
I don't see anything like this in the current beta or published
libraries. The Boost Test Library looks like a good platform to build
such a thing on top of, though.
Motivation: Recently an engineer in my group tracked down a mysterious
random crash problem to a bug in the comparison predicate used with a
map<> container. Unfortunately this was my code :^). I would love to
be able to write, as part of my unit test, something like this:
test_functor_concept<StrictWeakOrdering>(MyLessThan(),
ArgumentGenerator());
where I supply the functor (MyLessThan) and a generator functor that
creates test objects in a reproducible way for use by the test harness.
Perhaps a third argument specifying the amount of time to spend on the
testing would be useful. Anything like this already out there?
If not, and people think it useful, I might write it myself. Please let
me know what you think.
-- John Panzer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk