Boost logo

Boost :

Subject: Re: [boost] How do you test complex transformations?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-03-18 13:44:26


AMDG

On 03/18/2011 10:23 AM, Vicente Botet wrote:
> I know that my question is not directly associated to Boost, but it could be
> interesting to share the best techniques so we can improve the test of some
> Boost libraries, existing or future.
>
> A transformation complex is complex if I can not associate mentally the
> output associated to a given input. Think for example on dividing two bit
> integers.
>
> One technique could be to make the transformation by hand and keep track of
> the input -> output association.
> Another technique consist in re-implementing the algorithm and check that
> both implementations match.
>
> Do you know other techniques? Does some Boost libraries have such a kind of
> transformations? How they are tested?

* Compute the inverse transformation and check
   that you get back the original value. e.g.
   q, r = div(a, b);
   assert(r + q * b == a);
* Combine multiple transformations in
   different ways which should produce
   identical results. e.g.
   assert(a/b/c == a/(b * c) == a/c/b)

In Christ,
Steven Watanabe


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