cloudflare/cloudflared

Public

mirrored from https://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2019.2.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

h2mux/bytes_counter_test.go

23lines · modecode

1package h2mux
2
3import (
4 "sync"
5 "testing"
6
7 "github.com/stretchr/testify/assert"
8)
9
10func TestCounter(t *testing.T) {
11 var wg sync.WaitGroup
12 wg.Add(dataPoints)
13 c := AtomicCounter{}
14 for i := 0; i < dataPoints; i++ {
15 go func() {
16 defer wg.Done()
17 c.IncrementBy(uint64(1))
18 }()
19 }
20 wg.Wait()
21 assert.Equal(t, uint64(dataPoints), c.Count())
22 assert.Equal(t, uint64(0), c.Count())
23}