Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-01-22 08:58:12


At 09:53 PM 1/21/2002, Andrei Alexandrescu wrote:

>> In addition, the predefined policies need to be tested as well. This
can
>be
>> done policy by policy if each policy has a formal specification and
their
>> behavior is not affected by the parent SmartPtr (which implies no
>> interaction between policies.)
>
>
>I think that that's the main point. As long as policies are orthogonal,
>they
>can be tested in isolation. For example, if CheckingPolicy doesn't
interact
>with any other policy, a suite can test all CheckingPolicy
implementations
>using some arbitrary choices for the other policies.
>
>Otherwise, I was thinking of a testing strategy similar to Jeremy's -
tests
>are generated by templates, and testing specific cases/behaviors are
>modeled
>with specialization of the test cases.

Yes, even if policies interact, they can still be tested in isolation if
the interaction is well-specified and bounded.

For example, let's say StoragePolicy is specified to always supply one type
(say pointer_type) and one function (say get()) via its public interface.

An OwnershipPolicy which accesses a StoragePolicy can still be tested in
isolation. Its test driver will have to supply one or more dummy
StoragePolicys which meet the requirements (supply well-formed pointer_type
and get()) but do nothing more.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk