test: add Drop to fuzz test, add drop test cases

This commit is contained in:
2026-03-19 20:13:11 -04:00
parent e2ba398a62
commit bb874a2aba
4 changed files with 45 additions and 8 deletions

View File

@@ -129,7 +129,7 @@ func TestRemove(t *testing.T) {
assert.True(table.Has(0))
}
func TestDropItem(t *testing.T) {
func TestDropExistingItem(t *testing.T) {
assert := assert.New(t)
key, value := 0, true
table := cuckoo.NewTable[int, bool]()
@@ -141,3 +141,15 @@ func TestDropItem(t *testing.T) {
assert.Equal(0, table.Size())
assert.False(table.Has(key))
}
func TestDropNoItem(t *testing.T) {
assert := assert.New(t)
key := 0
table := cuckoo.NewTable[int, bool]()
err := table.Drop(key)
assert.NoError(err)
assert.Equal(0, table.Size())
assert.False(table.Has(key))
}