[Proj] Testing framework

Even Rouault even.rouault at spatialys.com
Tue May 29 10:15:14 PDT 2018


Hi,

I was researching a framework to test my new code (and that could also be used 
to test the existing C API if needed). Currently src/gie.c has ad-hoc testing, 
but it is really limited feature-wise: no nice error message (returns error 
code), no way to make a testcase go on even if a test check fails, etc...

So a dedicated framework seems a better idea, and I've found catch2 :
	https://github.com/catchorg/Catch2/blob/master/docs/Readme.md

One of its main feature it is a header only testing framework, which means we 
can embed it easily in proj source tree, which is practical compared to other 
frameworks I've considered ( googletest, cppunit,  etc... ).
The tut framework used by GDAL and GEOS
( http://mrzechonek.github.io/tut-framework ) would also enter this category 
of header(s) only, but it has not as much as activity than catch2.
There's also Boost.Test, but I was a bit afraid with the boost name in it 
(although apparently it has a standalone mode).

Example of tests I've just written with catch2 (just a minimalistic use of the 
testing framework)
https://github.com/rouault/proj.4/blob/iso19111_ptr/test/cpp/test_crs.cpp

I'm not particularly calling for a flame debate on the suject, just wanting to 
mention this finding.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



More information about the Proj mailing list