MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestCounter_IncreaseKey

Function TestCounter_IncreaseKey

internal/utils/counters/counter_test.go:32–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestCounter_IncreaseKey(t *testing.T) {
33 var a = assert.NewAssertion(t)
34
35 var counter = counters.NewCounter[uint32]()
36 a.IsTrue(counter.IncreaseKey("1", 10) == 1)
37 a.IsTrue(counter.IncreaseKey("1", 10) == 2)
38 a.IsTrue(counter.IncreaseKey("2", 10) == 1)
39
40 counter.ResetKey("1")
41 a.IsTrue(counter.GetKey("1") == 0) // changed
42 a.IsTrue(counter.GetKey("2") == 1) // not changed
43}
44
45func TestCounter_GC(t *testing.T) {
46 if !testutils.IsSingleTesting() {

Callers

nothing calls this directly

Calls 3

IncreaseKeyMethod · 0.80
ResetKeyMethod · 0.80
GetKeyMethod · 0.80

Tested by

no test coverage detected