(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestStat_EncodeValueKey(t *testing.T) { |
| 12 | var a = assert.NewAssertion(t) |
| 13 | |
| 14 | var stat = &metrics.Stat{ |
| 15 | ServerId: 1, |
| 16 | Keys: []string{"${remoteAddr}"}, |
| 17 | Hash: "123456", |
| 18 | Value: 123, |
| 19 | Time: "20240101", |
| 20 | } |
| 21 | |
| 22 | var valueKey = stat.EncodeValueKey(100) |
| 23 | t.Log(valueKey) |
| 24 | |
| 25 | serverId, timeString, version, value, hash, err := metrics.DecodeValueKey(valueKey) |
| 26 | if err != nil { |
| 27 | t.Fatal(err) |
| 28 | } |
| 29 | t.Log(serverId, timeString, value, version, hash) |
| 30 | a.IsTrue(serverId == 1) |
| 31 | a.IsTrue(timeString == "20240101") |
| 32 | a.IsTrue(value == 123) |
| 33 | a.IsTrue(version == 100) |
| 34 | a.IsTrue(hash == "123456") |
| 35 | } |
| 36 | |
| 37 | func TestStat_EncodeSumKey(t *testing.T) { |
| 38 | var a = assert.NewAssertion(t) |
nothing calls this directly
no test coverage detected