Skip to content

Commit

Permalink
Test com.Counter#Reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Jul 19, 2024
1 parent a0c2307 commit 9590392
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions com/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,17 @@ func TestCounter_Add(t *testing.T) {
require.Equal(t, uint64(65), c.Val(), "unexpected new value")
require.Equal(t, uint64(65), c.Total(), "unexpected new total")
}

func TestCounter_Reset(t *testing.T) {
var c Counter

c.Add(42)
c.Reset()

require.Equal(t, uint64(0), c.Val(), "unexpected value")
require.Equal(t, uint64(42), c.Total(), "unexpected total")

c.Add(23)
require.Equal(t, uint64(23), c.Val(), "unexpected new value")
require.Equal(t, uint64(65), c.Total(), "unexpected new total")
}

0 comments on commit 9590392

Please sign in to comment.