Skip to content

Commit 92f4f76

Browse files
committed
fix tests
1 parent e2db2e2 commit 92f4f76

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/pure/collections/sets.nim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,7 @@ proc pop*[A](s: var HashSet[A]): A =
337337
## * `clear proc <#clear,HashSet[A]>`_
338338
runnableExamples:
339339
var s = toHashSet([2, 1])
340-
assert s.pop == 1
341-
assert s.pop == 2
340+
assert [s.pop, s.pop] in [[1, 2], [2,1]] # order unspecified
342341
doAssertRaises(KeyError, echo s.pop)
343342

344343
for h in 0 .. high(s.data):
@@ -1020,7 +1019,7 @@ when isMainModule and not defined(release):
10201019

10211020
block toSeqAndString:
10221021
var a = toHashSet([2, 7, 5])
1023-
var b = initHashSet[int]()
1022+
var b = initHashSet[int](rightSize(a.len))
10241023
for x in [2, 7, 5]: b.incl(x)
10251024
assert($a == $b)
10261025
#echo a

lib/pure/hashes.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ proc hashData*(data: pointer, size: int): Hash =
9191

9292
proc hashBiggestIntVM(x: BiggestInt): Hash = discard # in vmops
9393

94-
proc hash*(x: string): Hash
94+
proc hash*(x: string): Hash {.noSideEffect.}
9595

9696
proc hashBiggestInt*(x: BiggestInt): Hash {.inline.} =
9797
## for internal use; user code should prefer `hash` overloads

0 commit comments

Comments
 (0)