blob: ec0e04c4f1326ee4064a41b62b674e4c83bac16e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package promtest
import (
"sync"
)
//nolint:stylecheck // This is unintentionally missing documentation.
type MockCounter struct {
m sync.RWMutex
value float64
}
//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Value() float64 {
m.m.RLock()
defer m.m.RUnlock()
return m.value
}
//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Inc() {
m.Add(1)
}
//nolint:stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Add(v float64) {
m.m.Lock()
defer m.m.Unlock()
m.value += v
}
|