[Proj] Testing framework
even.rouault at spatialys.com
Wed May 30 14:59:23 EST 2018
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
> Either way, I will keep on doing PROJ/GEOS/GDAL testing in gtest for my own
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:
#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
completely unmodified () and
All tests passed (347 assertions in 7 test cases)
Interestingly there seems to be a slight precision issue on Mac on 2 steps.
 except an issue with isnan in pj_phi2_test.cpp, unrelated to the testing framework
probably using std::isnan instead of the macro hack would be better.
Spatialys - Geospatial professional services
More information about the Proj