|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-02-04 06:52:06
on 2/4/00 5:47 AM, jorg.schaible_at_[hidden] at jorg.schaible_at_[hidden] wrote:
> - For some constructs I would have used member template functions (BTW: Can a
> c'tor be a tmeplated function?). Unfortunately this would currently exclude
> VC6
> users.
Yes, there are template member function constructors. Actually, VC6 does
support member templates, though it has a few quirks.
Here are 2 features I've put in C++ unit testing facilities in the past:
1. a base class unit_test defined such that a subclass instance, when
declared at namespace (global) scope in a file, is automatically linked
(upon construction) into a chain of tests to be run (usually just after the
program has completed its initialization phase)**
2. A pseudo-random number generator to be used to ensure coverage in
randomly exercising the code. The important features are:
a. by default, it is seeded differently at every run
b. it is possible to retrieve the seed used for any run (e.g. after an
assertion failure)
c. it is possible to force the seed for any particular run so you can
reproduce a case.
**C++ compilers are free to optimize away static construction of variables
in translation units which they can prove are never otherwise used. This
means that you can't just write a translation unit containing a unit test
and nothing else using this technique. We might decide it was too risky an
approach.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk