Skip to content

Commit

Permalink
Test com.Counter#Add()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Jul 19, 2024
1 parent c2d7928 commit a0c2307
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions com/counter_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com

import (
"github.com/stretchr/testify/require"
"testing"
)

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

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

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

0 comments on commit a0c2307

Please sign in to comment.