mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fixed bug in FlatHashtbl.remove
This commit is contained in:
parent
88ceeb5430
commit
c192d5558a
2 changed files with 3 additions and 4 deletions
|
|
@ -182,7 +182,7 @@ module Make(H : Hashtbl.HashedType) =
|
||||||
let j = addr h n i in
|
let j = addr h n i in
|
||||||
match buckets.(j) with
|
match buckets.(j) with
|
||||||
| Used (key', _) when H.equal key key' ->
|
| Used (key', _) when H.equal key key' ->
|
||||||
buckets.(i) <- Deleted;
|
buckets.(j) <- Deleted;
|
||||||
t.size <- t.size - 1 (* remove slot *)
|
t.size <- t.size - 1 (* remove slot *)
|
||||||
| Deleted | Used _ ->
|
| Deleted | Used _ ->
|
||||||
probe h n (i+1) (* search further *)
|
probe h n (i+1) (* search further *)
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,8 @@ let test_eq () =
|
||||||
let h = IHashtbl.create 3 in
|
let h = IHashtbl.create 3 in
|
||||||
IHashtbl.replace h 1 "odd";
|
IHashtbl.replace h 1 "odd";
|
||||||
IHashtbl.replace h 2 "even";
|
IHashtbl.replace h 2 "even";
|
||||||
OUnit.assert_equal (IHashtbl.find h 3) "odd";
|
OUnit.assert_equal (IHashtbl.find h 1) "odd";
|
||||||
OUnit.assert_equal (IHashtbl.find h 51) "odd";
|
OUnit.assert_equal (IHashtbl.find h 2) "even";
|
||||||
OUnit.assert_equal (IHashtbl.find h 42) "even";
|
|
||||||
()
|
()
|
||||||
|
|
||||||
let test_copy () =
|
let test_copy () =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue