[Proj] Testing framework

Kurt Schwehr schwehr at gmail.com
Wed May 30 15:13:40 EST 2018


Fun! (but a lot terrifying)

Agreed that std::isnan is probably better.

A more interesting case is when I use a class to setup/tear down a new ctx
for each test to give a clean error env...

https://github.com/schwehr/gdal-autotest2/blob/master/cpp/third_party/proj/aasincos_test.cc

I'll send a pull request to remove the Apache 2 license statement.  I don't
want to be adding code under a 2nd license to PROJ!

On Wed, May 30, 2018 at 12:59 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> On mercredi 30 mai 2018 11:36:06 CEST Kurt Schwehr wrote:
> > So... Just to state my preference.  I think Google
> > Test(gtest/gmock/microbenchmark) would be great if PROJ decides to go
> that
> > way.  It's been run through the ringer with hundreds of millions of lines
> > of tests written with it and it covers most use cases without being to
> > heavy weight.  And I would be happy to contribute my tests to PROJ
> > (switching them to the PROJ license) and drop them from gdal-autotest2.
> >
> > I really don't know Catch2 so I don't really have an opinion on how well
> it
> > works.
> >
> > Either way, I will keep on doing PROJ/GEOS/GDAL testing in gtest for my
> own
> > work.
>
> I'm pretty sure for our basic needs whatever modern unit testing framework
> would do. catch2 with
> its single header was just easier to integrate, and thus passed the least
> effort principle.
>
> Just as an exercice, I've created a fake "gunit.h" that redirects to
> catch2:
> {{{
> #include "catch.hpp"
>
> #define STR(x) #x
> #define CONCAT(x,y) STR(x ## _ ## y)
>
> #define TEST(x,y) TEST_CASE(CONCAT(x,y))
> #define ASSERT_EQ(x,y) CHECK( (x) == (y) )
> #define EXPECT_DOUBLE_EQ(x,y) CHECK( (x) == (y) )
> #define EXPECT_TRUE(x) CHECK(x)
> #define EXPECT_NEAR(x,y,tolerance) CHECK( (x) ==
> Approx(y).margin(tolerance) )
> }}}
>
> and with that, I could integrate
> https://github.com/schwehr/gdal-autotest2/blob/master/
> cpp/third_party/proj/
>         PJ_geos_test.cc
>         pj_phi2_test.cc
>         geodesic_test.cc
>
> completely unmodified ([1]) and
> """
> All tests passed (347 assertions in 7 test cases)
> """
>
> See:
> https://github.com/OSGeo/proj.4/commit/1e42254017c118c082bd79a6d63136
> d459c7d934
>
> Interestingly there seems to be a slight precision issue on Mac on 2 steps.
> See https://travis-ci.org/rouault/proj.4/builds/385859941
>
>
> Even
>
> [1] except an issue with isnan in pj_phi2_test.cpp, unrelated to the
> testing framework
> https://github.com/rouault/proj.4/commit/ba4ef84f2be6b8532af527f1380e60
> 71430165cd
> probably using std::isnan instead of the macro hack would be better.
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>



-- 
--
http://schwehr.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20180530/032c799f/attachment-0001.htm 


More information about the Proj mailing list