def _get_int_dict(self): def eq(a, b): return a == b return rordereddict.get_ll_dict(lltype.Signed, lltype.Signed, ll_fasthash_function=intmask, ll_hash_function=intmask, ll_eq_function=eq)
def _get_str_dict(): # STR -> lltype.Signed DICT = rordereddict.get_ll_dict(lltype.Ptr(rstr.STR), lltype.Signed, ll_fasthash_function=rstr.LLHelpers.ll_strhash, ll_hash_function=rstr.LLHelpers.ll_strhash, ll_eq_function=rstr.LLHelpers.ll_streq, dummykeyobj=dummykeyobj, dummyvalueobj=dummyvalueobj) return DICT
def test_direct_enter_and_del(self): def eq(a, b): return a == b DICT = rordereddict.get_ll_dict(lltype.Signed, lltype.Signed, ll_fasthash_function=intmask, ll_hash_function=intmask, ll_eq_function=eq) ll_d = rordereddict.ll_newdict(DICT) numbers = [i * rordereddict.DICT_INITSIZE + 1 for i in range(8)] for num in numbers: rordereddict.ll_dict_setitem(ll_d, num, 1) rordereddict.ll_dict_delitem(ll_d, num) for k in foreach_index(ll_d): assert k < rordereddict.VALID_OFFSET