mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 18:39:58 +00:00
TUN-528: Move cloudflared into a separate repo
This commit is contained in:
23
h2mux/bytes_counter_test.go
Normal file
23
h2mux/bytes_counter_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package h2mux
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCounter(t *testing.T) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(dataPoints)
|
||||
c := AtomicCounter{}
|
||||
for i := 0; i < dataPoints; i++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
c.IncrementBy(uint64(1))
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
assert.Equal(t, uint64(dataPoints), c.Count())
|
||||
assert.Equal(t, uint64(0), c.Count())
|
||||
}
|
Reference in New Issue
Block a user