[backport] pseudorandom probing for hash collision (#13418)
This commit is contained in:
parent
273a93581f
commit
8c22518d67
12 changed files with 258 additions and 178 deletions
|
|
@ -3,7 +3,7 @@ discard """
|
|||
output: '''true'''
|
||||
"""
|
||||
|
||||
import hashes, tables, sharedtables
|
||||
import hashes, tables, sharedtables, testutils
|
||||
|
||||
const
|
||||
data = {
|
||||
|
|
@ -47,8 +47,7 @@ block tableTest1:
|
|||
for x in 0..1:
|
||||
for y in 0..1:
|
||||
assert t[(x,y)] == $x & $y
|
||||
assert($t ==
|
||||
"{(x: 1, y: 1): \"11\", (x: 0, y: 0): \"00\", (x: 0, y: 1): \"01\", (x: 1, y: 0): \"10\"}")
|
||||
assert t.sortedPairs == @[((x: 0, y: 0), "00"), ((x: 0, y: 1), "01"), ((x: 1, y: 0), "10"), ((x: 1, y: 1), "11")]
|
||||
|
||||
block tableTest2:
|
||||
var t = initTable[string, float]()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue