Overview
Features
Download
Documentation
Community
Add-Ons & Services

Enhancement request for Cppunit

General discussion regarding the development of POCO for contributors.

Enhancement request for Cppunit

Postby marlowa » 25 Jul 2006, 00:19

In TestCase.h there is an assert macro (pity its name clashes with the C-style assert but that's a separate story). I propose that a couple more macros are added that allow an assertion to failure to report additional line numbers. The line of code that is the assertion failure is needed of course, and is given by __LINE__ at the assertion point. But one can assert in a loop when looping around static data test cases. In these cases not only is the assert line needed but also the index of the data. You may also have a loop within a loop (it is rare when there are more than 2levels of nesting when generating test cases).

The macros could be called loop_1_assert(line, condition) and loop_2_assert(Line1, line2, condition).

I am currently extending the unit test for the POCO DateTime class and these macros would have been extremely useful. What do people think?

-Andrew Marlow
marlowa
 
Posts: 36
Joined: 19 Jul 2006, 09:02
Location: United_Kingdom

Return to Contributors

Who is online

Users browsing this forum: No registered users and 0 guests