<div dir="ltr">Fun! (but a lot terrifying)<div><br></div><div>Agreed that std::isnan is probably better.<br><div><br></div><div>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...</div><div><br></div><div><a href="https://github.com/schwehr/gdal-autotest2/blob/master/cpp/third_party/proj/aasincos_test.cc">https://github.com/schwehr/gdal-autotest2/blob/master/cpp/third_party/proj/aasincos_test.cc</a><br></div><div><br></div><div>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!</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 30, 2018 at 12:59 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On mercredi 30 mai 2018 11:36:06 CEST Kurt Schwehr wrote:<br>
> So... Just to state my preference. I think Google<br>
> Test(gtest/gmock/<wbr>microbenchmark) would be great if PROJ decides to go that<br>
> way. It's been run through the ringer with hundreds of millions of lines<br>
> of tests written with it and it covers most use cases without being to<br>
> heavy weight. And I would be happy to contribute my tests to PROJ<br>
> (switching them to the PROJ license) and drop them from gdal-autotest2.<br>
> <br>
> I really don't know Catch2 so I don't really have an opinion on how well it<br>
> works.<br>
> <br>
> Either way, I will keep on doing PROJ/GEOS/GDAL testing in gtest for my own<br>
> work.<br>
<br>
</span>I'm pretty sure for our basic needs whatever modern unit testing framework would do. catch2 with<br>
its single header was just easier to integrate, and thus passed the least effort principle.<br>
<br>
Just as an exercice, I've created a fake "gunit.h" that redirects to catch2:<br>
{{{<br>
#include "catch.hpp"<br>
<br>
#define STR(x) #x<br>
#define CONCAT(x,y) STR(x ## _ ## y)<br>
<br>
#define TEST(x,y) TEST_CASE(CONCAT(x,y))<br>
#define ASSERT_EQ(x,y) CHECK( (x) == (y) )<br>
#define EXPECT_DOUBLE_EQ(x,y) CHECK( (x) == (y) )<br>
#define EXPECT_TRUE(x) CHECK(x)<br>
#define EXPECT_NEAR(x,y,tolerance) CHECK( (x) == Approx(y).margin(tolerance) )<br>
}}}<br>
<br>
and with that, I could integrate <br>
<a href="https://github.com/schwehr/gdal-autotest2/blob/master/cpp/third_party/proj/" rel="noreferrer" target="_blank">https://github.com/schwehr/<wbr>gdal-autotest2/blob/master/<wbr>cpp/third_party/proj/</a><br>
PJ_geos_test.cc<br>
pj_phi2_test.cc<br>
geodesic_test.cc<br>
<br>
completely unmodified ([1]) and<br>
"""<br>
All tests passed (347 assertions in 7 test cases)<br>
"""<br>
<br>
See:<br>
<a href="https://github.com/OSGeo/proj.4/commit/1e42254017c118c082bd79a6d63136d459c7d934" rel="noreferrer" target="_blank">https://github.com/OSGeo/proj.<wbr>4/commit/<wbr>1e42254017c118c082bd79a6d63136<wbr>d459c7d934</a><br>
<br>
Interestingly there seems to be a slight precision issue on Mac on 2 steps.<br>
See <a href="https://travis-ci.org/rouault/proj.4/builds/385859941" rel="noreferrer" target="_blank">https://travis-ci.org/rouault/<wbr>proj.4/builds/385859941</a><br>
<br>
<br>
Even<br>
<br>
[1] except an issue with isnan in pj_phi2_test.cpp, unrelated to the testing framework<br>
<a href="https://github.com/rouault/proj.4/commit/ba4ef84f2be6b8532af527f1380e6071430165cd" rel="noreferrer" target="_blank">https://github.com/rouault/<wbr>proj.4/commit/<wbr>ba4ef84f2be6b8532af527f1380e60<wbr>71430165cd</a><br>
probably using std::isnan instead of the macro hack would be better.<br>
<div class="HOEnZb"><div class="h5"><br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--<div><a href="http://schwehr.org" target="_blank">http://schwehr.org</a></div></div>
</div>