Skip to content

Conversation

isaacbrodsky
Copy link
Collaborator

WIP while working on how to handle coverage for this. There are a few branches which I know to be unreachable because the checks are duplicated.

@coveralls
Copy link

coveralls commented Oct 22, 2021

Coverage Status

Coverage decreased (-0.3%) to 98.2% when pulling 8fba70d on isaacbrodsky:error-returns-directededge into 583de2f on uber:master.

@isaacbrodsky isaacbrodsky marked this pull request as ready for review October 22, 2021 23:43
H3Index origin;
H3Error originResult = H3_EXPORT(getDirectedEdgeOrigin)(edge, &origin);
if (originResult) {
// TODO: Not coverable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We could make this coverable by dropping the E_DIR_EDGE_INVALID check in this function and delegating that to getDirectedEdgeOrigin. The cost of the allocations we do before that call seems minimal.

H3Index origin;
H3Error originResult = H3_EXPORT(getDirectedEdgeOrigin)(edge, &origin);
if (originResult) {
// TODO: Unreachable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, we could drop the corresponding H3_DIRECTEDEDGE_MODE check within this function, possibly moving this call to the beginning, for full coverage.

CellBoundary cb;

H3_EXPORT(directedEdgeToBoundary)(edge, &cb);
H3Error err = H3_EXPORT(directedEdgeToBoundary)(edge, &cb);
if (err) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I find this reads much more clearly as err than result as you've used elsewhere. We should probably be consistent here, but I'd suggest either standardizing on err or funcErr or IS_H3_ERROR(funcResult) to make it clearer to the reader that if we have a truthy return value, it indicates an error.

@isaacbrodsky isaacbrodsky merged commit 0ad73b5 into uber:master Nov 20, 2021
@isaacbrodsky isaacbrodsky deleted the error-returns-directededge branch November 20, 2021 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants