MCPcopy
hub / github.com/kopia/kopia / TestConcurrentCountMap_Add

Function TestConcurrentCountMap_Add

internal/stats/count_map_test.go:37–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestConcurrentCountMap_Add(t *testing.T) {
38 var m CountersMap[int]
39
40 found := m.add(42, 5)
41 require.False(t, found, "Add on new key should return false to indicate 'key not previously found'")
42
43 v, found := m.Get(42)
44
45 require.EqualValues(t, 5, v, "expected 5 after add")
46 require.True(t, found)
47
48 found = m.add(42, 3)
49 require.True(t, found, "Add on existing key should return true")
50
51 v, found = m.Get(42)
52
53 require.EqualValues(t, 8, v, "expected 8 after second add")
54 require.True(t, found)
55}
56
57func TestConcurrentCountMap_Range(t *testing.T) {
58 var m CountersMap[string]

Callers

nothing calls this directly

Calls 2

GetMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected