From: Jason Hise (chaos_at_[hidden])
Date: 2005-03-02 21:20:12
Gennadiy Rozental wrote:
>"Jason Hise" <chaos_at_[hidden]> wrote in message
>>Is there a specific formal way that I should be writing test programs
>>for the singleton library? I was initially planning on just writing
>>program results to a file and providing a second file containing
>>expected output. However, because I am relatively new to boost I
>>thought that there might be some bigger testing framework that I need to
>>use. Is there?
>>Additionally, I don't quite understand what bjam is, but everything
>>seems to use it. Should I be using it as well, or does it only apply to
>>libraries that need to be compiled? Singleton uses only header files.
>>Thanks in advance for all replies.
>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.
It would appear that such tests are required to execute completely
inside of a function block. 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. 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.
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?
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?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk