[gdal-dev] Call for discussion: RFC88: Use GoogleTest framework for C/C++ unit tests

Kurt Schwehr schwehr at gmail.com
Wed Nov 16 11:28:10 PST 2022


I am +1 for this switch, but I'm definitely biased by working at Google.
My thoughts:

tut definitely gets the job done, but I found it a bit awkward too.  But I
think the updates and the additional features of GoogleTest are probably
worth it.  I especially like the distinction between ASSERT.* that
immediately stops a test when it finds and issue and EXPECT that lets the
test move forward until the end of that test so that I can see all of the
results of EXPECTS.  The formerly separate "mock" capabilities are really
handy too.

I wrote a bunch of C++ GDAL tests using GoogleTests in the 2013-207 time
frame (Even used a bit of that work as starters to the tests in PROJ, but
he went way beyond what I had).  I have a lot of the tests in github, but
they are written against very old versions of GDAL.  And, the GoogleTest
ability to work with newer versions of C++ has gotten a lot stronger.
C++17 wasn't even available when I wrote a lot of the test code.  We have
been upgrading GDAL and improving the tests, so if there is interest, I can
try to do some updates to the repo.  If any of the autotest2 code is used,
the license should be switched from Apache 2.0 to the MIT style
license mentioned
here
<https://github.com/OSGeo/gdal/blob/a394f9cb299b2c3c2159098483d1fece3a464fda/LICENSE.TXT#L15>
.

https://github.com/schwehr/gdal-autotest2/tree/master/cpp

-Kurt


On Wed, Nov 16, 2022 at 10:42 AM Even Rouault <even.rouault at spatialys.com>
wrote:

> Hi,
>
> As this is RFC season. I've prepared RFC88: Use GoogleTest framework for
> C/C++ unit tests
>
> Text at https://github.com/OSGeo/gdal/pull/6720
>
> Summary:
>
> The document proposes and describes conversion of the existing C/C++
> autotest suite to use the `GoogleTest
> framework <https://github.com/google/googletest>`__.
>
> GoogleTest is a popular and maintained framework for C/C++ test
> writing, that is a better replacement for the `TUT framework
> <https://github.com/mrzechonek/tut-framework>`__ that we use currently.
>
> Even
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221116/f38213d0/attachment.htm>


More information about the gdal-dev mailing list