(t *testing.T)
| 177 | } |
| 178 | |
| 179 | func TestHandleStore_CustomStartID(t *testing.T) { |
| 180 | t.Run("StartFromZero", func(t *testing.T) { |
| 181 | hs := newHandleStoreWithStartID(0) |
| 182 | id := hs.Store("test") |
| 183 | assert.Equal(t, int32(1), id) |
| 184 | assert.True(t, hs.Delete(id)) |
| 185 | }) |
| 186 | |
| 187 | t.Run("StartFromCustom", func(t *testing.T) { |
| 188 | const startID = int32(1000) |
| 189 | hs := newHandleStoreWithStartID(startID) |
| 190 | id := hs.Store("test") |
| 191 | assert.Equal(t, startID+1, id) |
| 192 | assert.True(t, hs.Delete(id)) |
| 193 | }) |
| 194 | |
| 195 | t.Run("BoundaryNearOverflow", func(t *testing.T) { |
| 196 | // Test behavior near MaxInt32 |
| 197 | hs := newHandleStoreWithStartID(math.MaxInt32 - 3) |
| 198 | |
| 199 | // Store 2 values successfully |
| 200 | id1 := hs.Store("value1") |
| 201 | id2 := hs.Store("value2") |
| 202 | assert.Equal(t, int32(math.MaxInt32-2), id1) |
| 203 | assert.Equal(t, int32(math.MaxInt32-1), id2) |
| 204 | |
| 205 | // Third store should panic |
| 206 | assert.Panics(t, func() { |
| 207 | hs.Store("value3") |
| 208 | }) |
| 209 | |
| 210 | // Clean up |
| 211 | assert.True(t, hs.Delete(id1)) |
| 212 | assert.True(t, hs.Delete(id2)) |
| 213 | }) |
| 214 | } |
| 215 | |
| 216 | func TestHandleStore_Concurrency(t *testing.T) { |
| 217 | hs := newHandleStore() |
nothing calls this directly
no test coverage detected