Martin Sebor wrote:
Farid Zaripov wrote:
[...]
3. ListTestCase was expanded from the StringTestCase structure by
adding additional members (functors Predicate, BinaryPredicate,
Compare) for the methods remove_if, unique, merge, sort. I think it
should be enough to define these members as a pointer to a function to
leave ListTestCase non-template.
I agree with not parameterizing the base class but I suspect that
simple function pointers aren't going to do it. The predicate
functions need to take the actual objects as arguments, not just
chars. In addition, storing three pointers when only one per test
case (or maybe one per test?) is needed seems wasteful. Would
something like the rough sketch below work?
Actually, I think we should be able to do something even simpler
than that. Assuming there will only be a small set of predicates
(say four) we will want to use in these tests, we can simply add
a integer data member to the ContainerTestCase struct to allow
us to pick the one to be used with each test case.
Martin