mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
19 lines
356 B
Nim
19 lines
356 B
Nim
import tables, random
|
|
var t = initOrderedTable[int,string]()
|
|
|
|
# this tests issue #5917
|
|
var data = newSeq[int]()
|
|
for i in 0..<1000:
|
|
var x = random(1000)
|
|
if x notin t: data.add(x)
|
|
t[x] = "meh"
|
|
|
|
# this checks that keys are re-inserted
|
|
# in order when table is enlarged.
|
|
var i = 0
|
|
for k, v in t:
|
|
doAssert(k == data[i])
|
|
doAssert(v == "meh")
|
|
inc(i)
|
|
|