change evict to delete in [kv]
This commit is contained in:
parent
682b141356
commit
62f5d8394b
1 changed files with 6 additions and 6 deletions
|
|
@ -45,8 +45,8 @@ set :: (kv: *Kv, key: kv.Key, value: kv.Value) {
|
|||
slot.value = value;
|
||||
}
|
||||
|
||||
// @note(judah): we use 'evict' instead of 'remove' because it's a keyword...
|
||||
evict :: (kv: *Kv, key: kv.Key) -> kv.Value, bool {
|
||||
// @note(judah): we use 'delete' instead of 'remove' because it's a keyword...
|
||||
delete :: (kv: *Kv, key: kv.Key) -> kv.Value, bool {
|
||||
slot, ok, idx := find_slot(kv, kv.hash_proc(key));
|
||||
if !ok return mem.zero_of(kv.Value), false;
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ hash :: #import "jc/hash";
|
|||
}
|
||||
|
||||
for 0..ITERATIONS if it % 2 == 0 {
|
||||
_, ok := evict(*values, it);
|
||||
_, ok := delete(*values, it);
|
||||
test.expect(t, ok);
|
||||
}
|
||||
|
||||
|
|
@ -164,12 +164,12 @@ hash :: #import "jc/hash";
|
|||
test.expect(t, values.count == 3);
|
||||
test.expect(t, values.slots.allocated == values.number_of_items_to_allocate_initially);
|
||||
|
||||
// evicting something that doesn't exist should do nothing
|
||||
_, ok := evict(*values, 0);
|
||||
// deleting something that doesn't exist should do nothing
|
||||
_, ok := delete(*values, 0);
|
||||
test.expect(t, !ok);
|
||||
test.expect(t, values.count == 3);
|
||||
|
||||
evict(*values, 2);
|
||||
delete(*values, 2);
|
||||
test.expect(t, values.count == 2);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue