parent
55c244400d
commit
cd51628f57
2 changed files with 23 additions and 2 deletions
18
tests/stdlib/torderedtable.nim
Normal file
18
tests/stdlib/torderedtable.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue