[fdo-dev] Assertions

Mateusz Loskot mateusz at loskot.net
Tue Aug 15 21:33:29 EDT 2006

Greg Boone wrote:
> Hi Mateusz,
> Since you are writing the PostGIS provider within the GenericRDBMS
> framework we expect to be able to build and test the PostGIS provider in
> the same manner and style as the MySQL and ODBC providers. This means we
> expect you to write unit tests for the PostGIS provider in a CppUnit
> style framework. 


Yes, I'm going provide well working CppUnit-based
tests for PostGIS provider. And this subject is not
influenced by my inclination use assertions.

> From our perspective, the build team are users as much as our external
> clients such as MapGuide. The build team will building the provider in
> Debug mode and executing the unit tests in Debug mode on a daily basis.

And if the build team will get assertion catch, it does - again - mean
that there is a serious bug and the development team has to deal
with it.

> It is critical that all tests be able to be executed without asserting
> or throwing an unhandled exception and all errors reported through
> standard CppUnit error handling/reporting mechanisms.
> The above 2 paragraphs deal with the newly developing PostGIS 'provider'
> code base. As for any modifications you plan for existing GenericRDBMS
> libraries such as RDBI, we expect that existing coding standards (as
> seen in the existing subversion files) be followed. If Asserts are not
> used in these components now then please do no introduce that behavior
> in new code being submitted.

Greg, I have to confess that this rule abut not using assertions
(I mean pre-/post-conditions and invariants assertions,
but not Unit Test assertions) is ridiculous.
It's like "please, don't run your code under debugger".
This rule dictates to not to use one of the important tool
in programmer's toolbox. IMHO without it, it will be hard and
time consuming to provide good quality of code, with high
percentage of LOC executed that means tested.

Sorry, but I can't "walk on the line" without good assecuration.
I'll use tools provided by C++ language for testing and debugging
but I'll also stick to FDO rulse about Unit Test.

Mateusz Loskot

More information about the Fdo-internals mailing list