Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Mar 19, 2020
1 parent ae94905 commit 04dcb22
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions tests/stdlib/tsharedtable.nim
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ block: # we use Table as groundtruth, it's well tested elsewhere
doAssert t.mgetOrPut(i, -2) == -2
doAssert t.mget(i) == -2

var numOK = 0
for i in 0..<n4:
let ok = i in t0
if ok:
numOK.inc
if not ok: t0[i] = -i
doAssert t.hasKeyOrPut(i, -i) == ok
doAssert numOK > 0
doAssert numOK < n4

checkEquals()

Expand All @@ -87,17 +92,3 @@ block: # we use Table as groundtruth, it's well tested elsewhere
var t0: Table[int, int]
testDel(t, t0)
deinitSharedTable(t)

block: # CHECKME:redundant w above?
let n = 100
let n2 = n * 2
for i in 0..<n:
table[i] = i
assert table.hasKeyOrPut(i, i)

for i in n..<n2:
assert not table.hasKeyOrPut(i, i)

for i in 0..<n2:
assert table.mgetOrPut(i, i) == i
assert table.mget(i) == i

0 comments on commit 04dcb22

Please sign in to comment.