Boost logo

Boost :

From: Gennadiy E. Rozental (rogeeff_at_[hidden])
Date: 2001-10-23 02:16:41


--- In boost_at_y..., "Mike Attili" <yahoomail_at_a...> wrote:
> Gennadiy,
> Thanks for the improvements to the unit test framework. I've
> been using the code in the 'unit_test_development' branch for
> several current projects and I've been anxiously awaiting your
> changes before I jump in (to avoid duplicate effort).
>
> I haven't had a chance to look over the code in detail, but
> I have a few observations:
> 1) There are two memory leaks in the framework. The first, carried
> over from the previous code, is that the ostrstream in
wrapstrstream
> (unit_test_tools.hpp) isn't freed. I just put in a
> {buf.freeze(false);} in the destructor but there maybe a better
way
> since I don't use strstream too often.
It's an exelent example of doing 2 things function. Instead of being
simple access method str() also freeze the buffer. I prefer to put
unfrezing imidiatelly after using str().

> The second is that unit_test_result::Impl::m_head
(unit_test_result.cpp)
> is never deleted. Changing it to a scoped_ptr<unit_test_result>
> does the job.
Done

> 2) std::distance() in parametrized_function_test_case and
> paramertized_class_test_case uses the 3 argument overload that
(I guess)
> is a hold-over from the original STL. MSVC doesn't supply the 3
arg
> version.
> Changing it to 'stages_amount() = std::distance( begin, end );'
works
> fine.
Well, the thing is that standart contains both function to allow
compilers (like MSVC) that do not support partial specialization and
accordingly can't deduce difference_type always to use 3 arg form.
BUT MSVC fake result_type - it's always ptrdiff_t - and does not
provide 3 arg version. I was using STLPort and did not remark it. We
could put fix specifically for native MSVC STL, what you think?

> 3) I get an assertion running unit_test_tools_test on the following
line:
> boost::output_test_stream output;
> It calls std::fstream with a NULL pattern file name. Not sure
what it
> should
> be doing in this case.
Again, I was using STLPOrt and it allows to use NULL pointer (and "")
as an argument to fstream open, while native MSVC issue an assert. I
can't find right now whether or not it's correct you can use " " as
default argument in output_test_stream constructor

>
> I'm running MSVC 6 sp5. There are a few features that I've added
locally
> that I'd like to integrate with this version of the unit test
framework. In
> particular: auto-registration of test cases and suites,
I was thinking about such feature while ago. The main question is
WHERE to register? This desision require presence of predefined
test_suite. Also word automatically means that it should happend
statically => we should now everything statically => test framework
should be ready to accept test cases before main start and all
variables used to define test case (like parameter list for
parameterized test case) should be efined statically. All we buy for
this is that you will not need to write test_suite->add statement. I
does not seems to be worth efforts.

> and regex selection of tests from the command line.
I have in my TO-DO list item adding an ability to run selected test
cases. It would not be wery difficult to implement. How we will get
this selected test cases list is another issue. There may be several
choises:
    command-line arguments - require some kind of connamd-line parser
    environment variable, or configuration file - both solutions have
an usebility issues.

I will probably try to implement simple light-weight command line
parser though I do not think it should be target for the first
submittion.

My future plans also include:

BOOST_IS_COMPILABLE BOOST_IS_NOT_COMPILABLE checks
Performnace test tools - we'll see what we can do portably in this
area
Memory usage test tools
Test case for template function and list of types to apply
Some other minor things.

Most of it should not be considered as target for initial submittion
but I will be willing to know about any ideas in those area.

Gennadiy.

> My objective is to be able to use the Boost
> unit test framework for 'test first design' like JUnit does for
Java.
>
> Mike Attili
> Amaxo, Inc.
>
> From: Gennadiy E. Rozental [mailto:rogeeff_at_m...]
> Subject: [boost] unit test framework
> > This is initial version for unit test framework. Library is
based
> > on initial work by Beman Dawes and Ullrich Koethe. I still
working on
> > documentation and more tests. Al tests and examples should pass
> > without errors. I provided for now MSVC workspace and projects you
> > can use to build everything and check how it works.
> >
> > I was able to test it with MSVC and Sun Forte C++ u.2
> >
> > Your suggestions about enhancements and new features greatly
> > appreciated.
> >
> > Gennadiy.


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