(t *testing.T)
| 118 | } |
| 119 | |
| 120 | func TestCounter(t *testing.T) { |
| 121 | synctest.Test(t, func(t *testing.T) { |
| 122 | c := NewCounter("test_counter") |
| 123 | c.Inc(100) |
| 124 | c.Inc(200) |
| 125 | c.Inc(300) |
| 126 | time.Sleep(1 * time.Second) |
| 127 | c.updateRate() |
| 128 | v := c.Value() |
| 129 | require.Equal(t, int64(600), v["total"]) |
| 130 | require.GreaterOrEqual(t, v["rate"], float64(590)) |
| 131 | c.reset() |
| 132 | require.Equal(t, int64(0), c.Value()["total"]) |
| 133 | require.Equal(t, float64(0), c.Value()["rate"]) |
| 134 | }) |
| 135 | } |
| 136 | |
| 137 | func TestStatistic(t *testing.T) { |
| 138 | s := NewStatistics("test_stats") |
nothing calls this directly
no test coverage detected