geos
geos copied to clipboard
Many C API functions lack tests
Functions and code paths not tested can be seen in this codecov report: https://codecov.io/gh/libgeos/geos/src/master/capi/geos_ts_c.cpp. You should be able to view it without an account at least once, but it seems to require login after a few page views.
This would be a great task for anyone who wants to begin contributing to GEOS.
The behavior of the underlying operations is generally tested elsewhere, but C API tests should at least verify that
- the function correctly operates with trivial inputs
- it preserves SRID, if applicable
- it returns the documented error code on error (if you can think of a way to trigger an error)
I would like to help out with this. Would you prefer one big pull request or several smaller pull requests (one for function)?
However you prefer to do it is good by me. Thanks!
I started by writing tests for GEOSDisjoint and GEOSTouches:
https://github.com/libgeos/geos/compare/master...jericks:codecov
Thanks! Here are my suggestions:
- instead of creating local variables for the test geometries, use the built-in member variables
geom1_,geom2_, etc. These will be automatically cleaned up, so you don't need to callGEOSGeom_destroy. You can peek at thecapitest::utilityclass to see a full list. - if you can test the necessary code paths with two geometries instead of three, that's better
- if you can test the necessary code paths with easily-readable geometries like
POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), that's better
To test all the *_r functions should add a struct utility_r to the capi_test_utils?
I see the appeal but am not sure it's worth it, since the non-_r functions are just trivial wrappers around the _r versions.
@jericks , any objection to me merging in the commits from your codecov branch?
No objections here.
On Wed, Oct 20, 2021, 4:19 PM Dan Baston @.***> wrote:
@jericks https://github.com/jericks , any objection to me merging in the commits from your codecov branch?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libgeos/geos/issues/396#issuecomment-948107222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABUKTYA3OGLKJJUCCWO4V3UH5FBHANCNFSM4W5CK7QQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Still seems a worthy goal, IMO.
This is in pretty good shape now.
