[geos-devel] First example of Unit Tests with TUT

Mateusz Łoskot mateusz at loskot.net
Wed Mar 15 20:01:13 EST 2006


After quite long process of selecting Unit Testing Framework,
we decided to use TUT (http://tut-framework.sourceforge.net/)
- very simple but powerful UTF.

TUT is only one header (+ 2 optional headers) C++ tool,
so it can be easily incorporated to GEOS sources.

Boost's UTF is also very good tool, but the main problem is that
the compatibility has been broken somewhere between
versions 1.30 - 1.33. Older versions is quite poor toolset in comparison
to 1.33, but tests written on base of 1.33 can not be used with 1.30.

After experiencing Boost,
we decided to use TUT as simple, so stable, tool that does the
testing job very well.
Also, nice advantage is that TUT simplicity makes it
easy to extend with new features and improvements.
Tonight, I added some small features
(e.g. displaying number of tests passed for every test group)
without much learning :-)
Another advantage I see is the idea of 'reporter' object,
that makes it easy to add new output format of test results (e.g. HTML
to publish on the GEOS website) and switch between output formats easily
(e.g. using command line options).

So, I've ported 2 new tests of Envelope class and isRectangle function
using TUT. Both tests are attached to this post, together with TUT
framework sources.

As we already decided with strk on the #postgis,
rest of JTS Unit Tests will be ported using TUT.

I'd like to encourage everyone interested to take a look at those test,
try to compile and run them.

- TUT sources: 3 files named as tut_*.h (included by test examples 
source files)

- Test examples:
-- main.cpp file is the entry point of Unit Testing
application (runner).
-- test_*.cpp files are test modules - every module consists of
one test group (a set of test cases)

All comments and questions are strongly welcome.

Best regards
Mateusz Łoskot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geos-tut-first-tests.tar.gz
Type: application/x-gzip
Size: 10821 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20060316/5ec57acd/geos-tut-first-tests.tar.gz

More information about the geos-devel mailing list