(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func TestCache_IncreaseInt64(t *testing.T) { |
| 98 | var a = assert.NewAssertion(t) |
| 99 | |
| 100 | var cache = NewCache[int64]() |
| 101 | var unixTime = time.Now().Unix() |
| 102 | |
| 103 | { |
| 104 | cache.IncreaseInt64("a", 1, unixTime+3600, false) |
| 105 | var item = cache.Read("a") |
| 106 | t.Log(item) |
| 107 | a.IsTrue(item.Value == 1) |
| 108 | a.IsTrue(item.expiredAt == unixTime+3600) |
| 109 | } |
| 110 | { |
| 111 | cache.IncreaseInt64("a", 1, unixTime+3600+1, true) |
| 112 | var item = cache.Read("a") |
| 113 | t.Log(item) |
| 114 | a.IsTrue(item.Value == 2) |
| 115 | a.IsTrue(item.expiredAt == unixTime+3600+1) |
| 116 | } |
| 117 | { |
| 118 | cache.Write("b", 1, time.Now().Unix()+3600+2) |
| 119 | t.Log(cache.Read("b")) |
| 120 | } |
| 121 | { |
| 122 | cache.IncreaseInt64("b", 1, time.Now().Unix()+3600+3, false) |
| 123 | t.Log(cache.Read("b")) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | func TestCache_Read(t *testing.T) { |
| 128 | if !testutils.IsSingleTesting() { |
nothing calls this directly
no test coverage detected