Skip to content

Commit 1866b04

Browse files
committed
[Capsule] Fix code style issues in test case
1 parent 5d84f63 commit 1866b04

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

Tests/CapsuleTests/CapsuleSmokeTests.swift

+29-29
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import CollectionsTestSupport
1414

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

1919
map[3] = "x"
2020
map[4] = "y"
@@ -27,7 +27,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
2727
}
2828

2929
func testSubscriptOverwrite() {
30-
var map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
30+
var map: HashMap<Int, String> = [1: "a", 2: "b"]
3131

3232
map[1] = "x"
3333
map[2] = "y"
@@ -38,7 +38,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
3838
}
3939

4040
func testSubscriptRemove() {
41-
var map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
41+
var map: HashMap<Int, String> = [1: "a", 2: "b"]
4242

4343
map[1] = nil
4444
map[2] = nil
@@ -49,9 +49,9 @@ final class CapsuleSmokeTests: CollectionTestCase {
4949
}
5050

5151
func testTriggerOverwrite1() {
52-
let map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
52+
let map: HashMap<Int, String> = [1: "a", 2: "b"]
5353

54-
let _ = map
54+
_ = map
5555
.inserting(key: 1, value: "x") // triggers COW
5656
.inserting(key: 2, value: "y") // triggers COW
5757

@@ -148,15 +148,15 @@ final class CapsuleSmokeTests: CollectionTestCase {
148148
expectEqual(map3.count, 0)
149149
}
150150

151-
private func hashPair<Key : Hashable, Value : Hashable>(_ k: Key, _ v: Value) -> Int {
151+
private func hashPair<Key: Hashable, Value: Hashable>(_ key: Key, _ value: Value) -> Int {
152152
var hasher = Hasher()
153-
hasher.combine(k)
154-
hasher.combine(v)
153+
hasher.combine(key)
154+
hasher.combine(value)
155155
return hasher.finalize()
156156
}
157157

158158
func testHashable() {
159-
let map: HashMap<Int, String> = [ 1 : "a", 2 : "b" ]
159+
let map: HashMap<Int, String> = [1: "a", 2: "b"]
160160

161161
let hashPair1 = hashPair(1, "a")
162162
let hashPair2 = hashPair(2, "b")
@@ -186,7 +186,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
186186
expectTrue(res1.contains(CollidableInt(12, 1)))
187187

188188
expectEqual(res1.count, 2)
189-
expectEqual(HashMap.init([CollidableInt(11, 1) : CollidableInt(11, 1), CollidableInt(12, 1) : CollidableInt(12, 1)]), res1)
189+
expectEqual(HashMap.init([CollidableInt(11, 1): CollidableInt(11, 1), CollidableInt(12, 1): CollidableInt(12, 1)]), res1)
190190

191191

192192
var res2 = res1
@@ -196,7 +196,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
196196
expectFalse(res2.contains(CollidableInt(12, 1)))
197197

198198
expectEqual(res2.count, 1)
199-
expectEqual(HashMap.init([CollidableInt(11, 1) : CollidableInt(11, 1)]), res2)
199+
expectEqual(HashMap.init([CollidableInt(11, 1): CollidableInt(11, 1)]), res2)
200200

201201

202202
var res3 = res1
@@ -206,7 +206,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
206206
expectTrue(res3.contains(CollidableInt(12, 1)))
207207

208208
expectEqual(res3.count, 1)
209-
expectEqual(HashMap.init([CollidableInt(12, 1) : CollidableInt(12, 1)]), res3)
209+
expectEqual(HashMap.init([CollidableInt(12, 1): CollidableInt(12, 1)]), res3)
210210

211211

212212
var resX = res1
@@ -218,7 +218,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
218218
expectTrue(resX.contains(CollidableInt(32769)))
219219

220220
expectEqual(resX.count, 2)
221-
expectEqual(HashMap.init([CollidableInt(11, 1) : CollidableInt(11, 1), CollidableInt(32769) : CollidableInt(32769)]), resX)
221+
expectEqual(HashMap.init([CollidableInt(11, 1): CollidableInt(11, 1), CollidableInt(32769): CollidableInt(32769)]), resX)
222222

223223

224224
var resY = res1
@@ -230,7 +230,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
230230
expectFalse(resY.contains(CollidableInt(32769)))
231231

232232
expectEqual(resY.count, 2)
233-
expectEqual(HashMap.init([CollidableInt(11, 1) : CollidableInt(11, 1), CollidableInt(12, 1) : CollidableInt(12, 1)]), resY)
233+
expectEqual(HashMap.init([CollidableInt(11, 1): CollidableInt(11, 1), CollidableInt(12, 1): CollidableInt(12, 1)]), resY)
234234
}
235235

236236
func testCompactionWhenDeletingFromHashCollisionNode2() {
@@ -245,7 +245,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
245245
expectTrue(res1.contains(CollidableInt(32769_2, 32769)))
246246

247247
expectEqual(res1.count, 2)
248-
expectEqual(HashMap.init([CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res1)
248+
expectEqual(HashMap.init([CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res1)
249249

250250

251251
var res2 = res1
@@ -256,7 +256,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
256256
expectTrue(res2.contains(CollidableInt(32769_2, 32769)))
257257

258258
expectEqual(res2.count, 3)
259-
expectEqual(HashMap.init([CollidableInt(1) : CollidableInt(1), CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res2)
259+
expectEqual(HashMap.init([CollidableInt(1): CollidableInt(1), CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res2)
260260

261261

262262
var res3 = res2
@@ -266,7 +266,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
266266
expectTrue(res3.contains(CollidableInt(32769_1, 32769)))
267267

268268
expectEqual(res3.count, 2)
269-
expectEqual(HashMap.init([CollidableInt(1) : CollidableInt(1), CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769)]), res3)
269+
expectEqual(HashMap.init([CollidableInt(1): CollidableInt(1), CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769)]), res3)
270270
}
271271

272272
func testCompactionWhenDeletingFromHashCollisionNode3() {
@@ -281,7 +281,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
281281
expectTrue(res1.contains(CollidableInt(32769_2, 32769)))
282282

283283
expectEqual(res1.count, 2)
284-
expectEqual(HashMap.init([CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res1)
284+
expectEqual(HashMap.init([CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res1)
285285

286286

287287
var res2 = res1
@@ -292,7 +292,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
292292
expectTrue(res2.contains(CollidableInt(32769_2, 32769)))
293293

294294
expectEqual(res2.count, 3)
295-
expectEqual(HashMap.init([CollidableInt(1) : CollidableInt(1), CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res2)
295+
expectEqual(HashMap.init([CollidableInt(1): CollidableInt(1), CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res2)
296296

297297

298298
var res3 = res2
@@ -302,7 +302,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
302302
expectTrue(res3.contains(CollidableInt(32769_2, 32769)))
303303

304304
expectEqual(res3.count, 2)
305-
expectEqual(HashMap.init([CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res3)
305+
expectEqual(HashMap.init([CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res3)
306306

307307

308308
expectEqual(res1, res3)
@@ -320,7 +320,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
320320
expectTrue(res1.contains(CollidableInt(32769_2, 32769)))
321321

322322
expectEqual(res1.count, 2)
323-
expectEqual(HashMap.init([CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res1)
323+
expectEqual(HashMap.init([CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res1)
324324

325325

326326
var res2 = res1
@@ -331,7 +331,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
331331
expectTrue(res2.contains(CollidableInt(32769_2, 32769)))
332332

333333
expectEqual(res2.count, 3)
334-
expectEqual(HashMap.init([CollidableInt(5) : CollidableInt(5), CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res2)
334+
expectEqual(HashMap.init([CollidableInt(5): CollidableInt(5), CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res2)
335335

336336

337337
var res3 = res2
@@ -341,7 +341,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
341341
expectTrue(res3.contains(CollidableInt(32769_2, 32769)))
342342

343343
expectEqual(res3.count, 2)
344-
expectEqual(HashMap.init([CollidableInt(32769_1, 32769) : CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769) : CollidableInt(32769_2, 32769)]), res3)
344+
expectEqual(HashMap.init([CollidableInt(32769_1, 32769): CollidableInt(32769_1, 32769), CollidableInt(32769_2, 32769): CollidableInt(32769_2, 32769)]), res3)
345345

346346

347347
expectEqual(res1, res3)
@@ -363,7 +363,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
363363
expectTrue(res1.contains(CollidableInt(32770_2, 32770)))
364364

365365
expectEqual(res1.count, 4)
366-
expectEqual(HashMap.init([CollidableInt(1) : CollidableInt(1), CollidableInt(1026) : CollidableInt(1026), CollidableInt(32770_1, 32770) : CollidableInt(32770_1, 32770), CollidableInt(32770_2, 32770) : CollidableInt(32770_2, 32770)]), res1)
366+
expectEqual(HashMap.init([CollidableInt(1): CollidableInt(1), CollidableInt(1026): CollidableInt(1026), CollidableInt(32770_1, 32770): CollidableInt(32770_1, 32770), CollidableInt(32770_2, 32770): CollidableInt(32770_2, 32770)]), res1)
367367

368368

369369
var res2 = res1
@@ -375,7 +375,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
375375
expectTrue(res2.contains(CollidableInt(32770_2, 32770)))
376376

377377
expectEqual(res2.count, 3)
378-
expectEqual(HashMap.init([CollidableInt(1) : CollidableInt(1), CollidableInt(32770_1, 32770) : CollidableInt(32770_1, 32770), CollidableInt(32770_2, 32770) : CollidableInt(32770_2, 32770)]), res2)
378+
expectEqual(HashMap.init([CollidableInt(1): CollidableInt(1), CollidableInt(32770_1, 32770): CollidableInt(32770_1, 32770), CollidableInt(32770_2, 32770): CollidableInt(32770_2, 32770)]), res2)
379379
}
380380

381381
func inferSize<Key, Value>(_ map: HashMap<Key, Value>) -> Int {
@@ -390,9 +390,9 @@ final class CapsuleSmokeTests: CollectionTestCase {
390390

391391
func testIteratorEnumeratesAll() {
392392
let map1: HashMap<CollidableInt, String> = [
393-
CollidableInt(11, 1) : "a",
394-
CollidableInt(12, 1) : "a",
395-
CollidableInt(32769) : "b"
393+
CollidableInt(11, 1): "a",
394+
CollidableInt(12, 1): "a",
395+
CollidableInt(32769): "b"
396396
]
397397

398398
var map2: HashMap<CollidableInt, String> = [:]
@@ -404,7 +404,7 @@ final class CapsuleSmokeTests: CollectionTestCase {
404404
}
405405
}
406406

407-
fileprivate final class CollidableInt : CustomStringConvertible, Equatable, Hashable {
407+
fileprivate final class CollidableInt: CustomStringConvertible, Equatable, Hashable {
408408
let value: Int
409409
let hashValue: Int
410410

0 commit comments

Comments
 (0)