-
Notifications
You must be signed in to change notification settings - Fork 603
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
Allow a counter to be manually reset #1527
Conversation
9be2b6e
to
55eafbe
Compare
With #1515 merged, would you be able to rebase this onto And thanks for this. It's something that I've written one-off workarounds on multiple occasions for. |
@seldridge Sure thing, I will get it out of draft status and mergable 👍 |
55eafbe
to
4be7452
Compare
@seldridge It has been rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I've wanted this for a while! Thanks for the contribution.
property("Counter can be reset") { | ||
forAll(smallPosInts) { (seed: Int) => assertTesterPasses{ new ResetTester(seed) } } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is probably overkill and it seems to repeat (at least locally, for me) seeds. Out of scope for this PR, though. I like having this PR consistent with the other tests here.
This PR adds a
reset
parameter to the Counter API, that allows a counter to be reset to its initial value.It is sometimes useful to be able to reset a counter arbitrarily. By default the
reset
parameter isfalse
, which means the proposed change is compatible with the existing API.For example
Type of change: other enhancement
Impact: API addition (no impact on existing code)
Development Phase: implementation
Release Notes
Allow counters to be reset