Skip to content

Conversation

@tim-hoffman
Copy link
Member

No description provided.

@linghuiluo
Copy link
Member

@swissiety can you review this?


// Assert that the set of boxes obtained from all units equals the set
// obtained by checking Unit#getBoxesPointingToThis() on all units.
Assert.assertEquals(new HashSet<>(getAllUnitBoxes(body)), new HashSet<>(getAllBoxesPointingToUnits(body)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

please assert that the transformer changed sth i.e. removed the trap

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

Comment on lines +105 to +108
UnitBox beginBox = trap.getBeginUnitBox();
UnitBox endBox = trap.getEndUnitBox();
UnitBox handlerBox = trap.getHandlerUnitBox();
if ((beginBox.getUnit() == endBox.getUnit()) || !reachable.contains(handlerBox.getUnit())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please restructure the UnitBox assignments inside the if block so the assignments are just executed when needed

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think any improvement can be made. The first two (beginBox and endBox) will always be used since they are in the first condition. The final variable (handlerBox) will always be used as well. If the first condition is true, it will be used inside the if statement body and if the first condition is false, it will be used in the second condition (and possibly again inside the body).

This ensures the trap was actually removed as expected. Also, rename the test method to something more meaningful.
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.

3 participants