Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Sprite unit test undefined behavior (gmock) #1183

Merged
merged 7 commits into from
Jan 2, 2025

Conversation

DanRStevens
Copy link
Collaborator

Part of:

Split of unit tests so only one EXPECT_CALL is needed per test, and it is before any calls to the mock handler.

The `EXPECT_CALL` has an implicit `Times(1)`, so the second `EXPECT_CALL` with `Times(0)` is redundant.
By removing the loop we also remove the `EXPECT_CALL` uses after a call has already been made to the mock. This is required to avoid undefined behavior.

The middle cases are less interesting, so we only preserve the boundary cases. Whether we use a time delta of 0, or one large enough to cycle through two stop frames, there should only ever be exactly one call to the handler. This is true even if the `advanceByTimeDelta` function is called a second time.
@DanRStevens DanRStevens merged commit ab73d3d into main Jan 2, 2025
8 checks passed
@DanRStevens DanRStevens deleted the fixSpriteUnitTestUndefinedBehavior branch January 2, 2025 12:08
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.

1 participant