#include "libnul.h" static size_t direct_hash (nul_const_ptr_t *ptr) { return (size_t)ptr; } static nul_bool_t direct_equal (nul_const_ptr_t *ptr1, nul_const_ptr_t *ptr2) { return ptr1 == ptr2; } int main () { nul_hash_t *hash = nul_hash_new (direct_hash, direct_equal, NULL, NULL); int i; for (i = 0; i < 1234; ++i) { nul_hash_insert (hash, (nul_ptr_t)i, (nul_ptr_t)i); } for (i = 0; i < 1234; ++i) { g_assert (nul_hash_has_key (hash, (nul_ptr_t)i)); } for (i = 0; i < 1234; ++i) { g_assert (nul_hash_remove (hash, (nul_ptr_t)i)); } for (i = 0; i < 1234; ++i) { g_assert (!nul_hash_has_key (hash, (nul_ptr_t)i)); } }