Skip to content

feat: add reset()#11

Open
timebis wants to merge 1 commit intoRobinUS2:masterfrom
timebis:master
Open

feat: add reset()#11
timebis wants to merge 1 commit intoRobinUS2:masterfrom
timebis:master

Conversation

@timebis
Copy link

@timebis timebis commented Dec 8, 2024

This pull request introduces a new Reset method to both the MovingAverage and ConcurrentMovingAverage classes and adds corresponding unit tests to ensure the functionality works as expected.

Key changes include:

  • New Reset Method:

    • ma.go: Added a Reset method to the MovingAverage class to reset its internal state.
    • ma_concurrent.go: Added a Reset method to the ConcurrentMovingAverage class, ensuring thread safety by locking and unlocking the mutex.
  • Unit Tests:

    • ma_test.go: Added a new test function TestReset to verify the behavior of the Reset method, including checking the count, average, and values before and after resetting.

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