Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-03-03 00:55:42


> >You could use Boost.Test. It has several components. You may select the
one
> >that fit best to your habits/needs. Particularly Boost.Test tools
includes
> >output_test_stream that allows to match your output vs. pattern file.
Check
> >docs for more details.
> >
> >Gennadiy
> >
> It would appear that such tests are required to execute completely
> inside of a function block.

That not nesseserily true. I am not sure I fully understand you though

> Unfortunately, the very nature of a
> singleton makes this impossible. I need to be able to check the
> lifetimes of singletons with relation to each other, and with relation
> to static and global objects.

Your design surely needs to cover function scope either (as any other
scope), isn't it?

> This means I cannot even use cout to
> report results, as the standard streams could close up shop before the
> last of my singletons is destroyed.

You may need to have separate program that specifically test that your
library correctly deals with pre/post main processing, but majority of the
logic should be testable on any scope.

> At the moment I am thinking that I will need to write two test
> programs... one to test the singletons and generate an output file, and
> one to verify the contents of the file that was generated. Does anyone
> see a simpler way?

The second one could easily use Boost.Test. I am afraid thouhg you may have
some difficulties integrating this solution with Boost.Build system

> Also, I should ask what the policy is on testing classes that use a
> policy based design. How many different combinations of policies are
> expected to be tested?

You could use BOOST_TEST_CASE_TEMPLATE facility to test combinations based
of mpl type sequences.

> -Jason

Gennadiy


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