Skip to content

Commit 9d631eb

Browse files
committed
tests: use Set<Int> instead of Dictionary<Int, Void>
1 parent a006d3c commit 9d631eb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

validation-test/stdlib/Hashing.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,15 @@ HashingTestSuite.test("_mixInt/GoldenValues") {
7373
HashingTestSuite.test("_squeezeHashValue/Int") {
7474
// Check that the function can return values that cover the whole range.
7575
func checkRange(_ r: Int) {
76-
var results = [Int : Void]()
76+
var results = Set<Int>()
7777
for _ in 0..<(14 * r) {
7878
let v = _squeezeHashValue(randInt(), r)
7979
expectTrue(v < r)
80-
if results[v] == nil {
81-
results[v] = Void()
82-
}
80+
results.insert(v)
8381
}
8482
expectEqual(r, results.count)
8583
}
84+
checkRange(1)
8685
checkRange(2)
8786
checkRange(4)
8887
checkRange(8)

0 commit comments

Comments
 (0)