Skip to content

Commit 997a1f6

Browse files
committed
[Capsule] Rename and simplify smoke tests
1 parent 08b1968 commit 997a1f6

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

Tests/CapsuleTests/CapsuleTests.swift Tests/CapsuleTests/CapsuleSmokeTests.swift

+24-28
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,40 @@
1212
import CollectionsTestSupport
1313
@_spi(Testing) import Capsule
1414

15-
final class CapsuleTests: CollectionTestCase {
15+
final class CapsuleSmokeTests: CollectionTestCase {
1616
func testSubscriptAdd() {
17-
var copyAndSetTest: HashMap<Int, String> =
18-
[ 1 : "a", 2 : "b" ]
17+
var map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
1918

20-
copyAndSetTest[3] = "x"
21-
copyAndSetTest[4] = "y"
19+
map[3] = "x"
20+
map[4] = "y"
2221

23-
expectEqual(copyAndSetTest.count, 4)
24-
expectEqual(copyAndSetTest[1], "a")
25-
expectEqual(copyAndSetTest[2], "b")
26-
expectEqual(copyAndSetTest[3], "x")
27-
expectEqual(copyAndSetTest[4], "y")
22+
expectEqual(map.count, 4)
23+
expectEqual(map[1], "a")
24+
expectEqual(map[2], "b")
25+
expectEqual(map[3], "x")
26+
expectEqual(map[4], "y")
2827
}
2928

3029
func testSubscriptOverwrite() {
31-
var copyAndSetTest: HashMap<Int, String> =
32-
[ 1 : "a", 2 : "b" ]
30+
var map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
3331

34-
copyAndSetTest[1] = "x"
35-
copyAndSetTest[2] = "y"
32+
map[1] = "x"
33+
map[2] = "y"
3634

37-
expectEqual(copyAndSetTest.count, 2)
38-
expectEqual(copyAndSetTest[1], "x")
39-
expectEqual(copyAndSetTest[2], "y")
35+
expectEqual(map.count, 2)
36+
expectEqual(map[1], "x")
37+
expectEqual(map[2], "y")
4038
}
4139

4240
func testSubscriptRemove() {
43-
var copyAndSetTest: HashMap<Int, String> =
44-
[ 1 : "a", 2 : "b" ]
41+
var map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
4542

46-
copyAndSetTest[1] = nil
47-
copyAndSetTest[2] = nil
43+
map[1] = nil
44+
map[2] = nil
4845

49-
expectEqual(copyAndSetTest.count, 0)
50-
expectEqual(copyAndSetTest[1], nil)
51-
expectEqual(copyAndSetTest[2], nil)
46+
expectEqual(map.count, 0)
47+
expectEqual(map[1], nil)
48+
expectEqual(map[2], nil)
5249
}
5350

5451
private func hashPair<Key : Hashable, Value : Hashable>(_ k: Key, _ v: Value) -> Int {
@@ -59,8 +56,7 @@ final class CapsuleTests: CollectionTestCase {
5956
}
6057

6158
func testHashable() {
62-
let copyAndSetTest: HashMap<Int, String> =
63-
[ 1 : "a", 2 : "b" ]
59+
let map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
6460

6561
let hashPair1 = hashPair(1, "a")
6662
let hashPair2 = hashPair(2, "b")
@@ -70,10 +66,10 @@ final class CapsuleTests: CollectionTestCase {
7066

7167
let expectedHashValue = commutativeHasher.finalize()
7268

73-
expectEqual(copyAndSetTest.hashValue, expectedHashValue)
69+
expectEqual(map.hashValue, expectedHashValue)
7470

7571
var inoutHasher = Hasher()
76-
copyAndSetTest.hash(into: &inoutHasher)
72+
map.hash(into: &inoutHasher)
7773

7874
expectEqual(inoutHasher.finalize(), expectedHashValue)
7975
}

0 commit comments

Comments
 (0)