Skip to content

Commit 6d97a0a

Browse files
committed
Adopt new XCTAssertEqualWithAccuracy spelling in the tests.
1 parent ea68075 commit 6d97a0a

5 files changed

+206
-206
lines changed

TestFoundation/TestNSAffineTransform.swift

+14-14
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ class TestNSAffineTransform : XCTestCase {
4545

4646
func checkPointTransformation(_ transform: NSAffineTransform, point: NSPoint, expectedPoint: NSPoint, _ message: String = "", file: StaticString = #file, line: UInt = #line) {
4747
let newPoint = transform.transform(point)
48-
XCTAssertEqualWithAccuracy(Double(newPoint.x), Double(expectedPoint.x), accuracy: accuracyThreshold,
49-
"x (expected: \(expectedPoint.x), was: \(newPoint.x)): \(message)", file: file, line: line)
50-
XCTAssertEqualWithAccuracy(Double(newPoint.y), Double(expectedPoint.y), accuracy: accuracyThreshold,
51-
"y (expected: \(expectedPoint.y), was: \(newPoint.y)): \(message)", file: file, line: line)
48+
XCTAssertEqual(Double(newPoint.x), Double(expectedPoint.x), accuracy: accuracyThreshold,
49+
"x (expected: \(expectedPoint.x), was: \(newPoint.x)): \(message)", file: file, line: line)
50+
XCTAssertEqual(Double(newPoint.y), Double(expectedPoint.y), accuracy: accuracyThreshold,
51+
"y (expected: \(expectedPoint.y), was: \(newPoint.y)): \(message)", file: file, line: line)
5252
}
5353

5454
func checkSizeTransformation(_ transform: NSAffineTransform, size: NSSize, expectedSize: NSSize, _ message: String = "", file: StaticString = #file, line: UInt = #line) {
5555
let newSize = transform.transform(size)
56-
XCTAssertEqualWithAccuracy(Double(newSize.width), Double(expectedSize.width), accuracy: accuracyThreshold,
57-
"width (expected: \(expectedSize.width), was: \(newSize.width)): \(message)", file: file, line: line)
58-
XCTAssertEqualWithAccuracy(Double(newSize.height), Double(expectedSize.height), accuracy: accuracyThreshold,
59-
"height (expected: \(expectedSize.height), was: \(newSize.height)): \(message)", file: file, line: line)
56+
XCTAssertEqual(Double(newSize.width), Double(expectedSize.width), accuracy: accuracyThreshold,
57+
"width (expected: \(expectedSize.width), was: \(newSize.width)): \(message)", file: file, line: line)
58+
XCTAssertEqual(Double(newSize.height), Double(expectedSize.height), accuracy: accuracyThreshold,
59+
"height (expected: \(expectedSize.height), was: \(newSize.height)): \(message)", file: file, line: line)
6060
}
6161

6262
func checkRectTransformation(_ transform: NSAffineTransform, rect: NSRect, expectedRect: NSRect, _ message: String = "", file: StaticString = #file, line: UInt = #line) {
@@ -74,13 +74,13 @@ class TestNSAffineTransform : XCTestCase {
7474

7575
// The diagonal entries (1,1) and (2,2) of the identity matrix are ones. The other entries are zeros.
7676
// TODO: These should use DBL_MAX but it's not available as part of Glibc on Linux
77-
XCTAssertEqualWithAccuracy(Double(transformStruct.m11), Double(1), accuracy: accuracyThreshold)
78-
XCTAssertEqualWithAccuracy(Double(transformStruct.m22), Double(1), accuracy: accuracyThreshold)
77+
XCTAssertEqual(Double(transformStruct.m11), Double(1), accuracy: accuracyThreshold)
78+
XCTAssertEqual(Double(transformStruct.m22), Double(1), accuracy: accuracyThreshold)
7979

80-
XCTAssertEqualWithAccuracy(Double(transformStruct.m12), Double(0), accuracy: accuracyThreshold)
81-
XCTAssertEqualWithAccuracy(Double(transformStruct.m21), Double(0), accuracy: accuracyThreshold)
82-
XCTAssertEqualWithAccuracy(Double(transformStruct.tX), Double(0), accuracy: accuracyThreshold)
83-
XCTAssertEqualWithAccuracy(Double(transformStruct.tY), Double(0), accuracy: accuracyThreshold)
80+
XCTAssertEqual(Double(transformStruct.m12), Double(0), accuracy: accuracyThreshold)
81+
XCTAssertEqual(Double(transformStruct.m21), Double(0), accuracy: accuracyThreshold)
82+
XCTAssertEqual(Double(transformStruct.tX), Double(0), accuracy: accuracyThreshold)
83+
XCTAssertEqual(Double(transformStruct.tY), Double(0), accuracy: accuracyThreshold)
8484
}
8585

8686
func test_IdentityTransformation() {

TestFoundation/TestNSProgressFraction.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class TestProgressFraction : XCTestCase {
104104
expectedResult = expectedResult + 1.0 / Double(d)
105105
}
106106

107-
XCTAssertEqualWithAccuracy(fractionResult, expectedResult, accuracy: 0.00001)
107+
XCTAssertEqual(fractionResult, expectedResult, accuracy: 0.00001)
108108
}
109109

110110
func test_addOverflow() {
@@ -126,7 +126,7 @@ class TestProgressFraction : XCTestCase {
126126
// And it should have completed value of about 1.0/4.0 + f1.fractionCompleted
127127
let expected = (1.0 / 4.0) + f1.fractionCompleted
128128

129-
XCTAssertEqualWithAccuracy(expected, f2.fractionCompleted, accuracy: 0.00001)
129+
XCTAssertEqual(expected, f2.fractionCompleted, accuracy: 0.00001)
130130
}
131131

132132
func test_andAndSubtractOverflow() {

TestFoundation/TestNSTimer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class TestNSTimer : XCTestCase {
5959
XCTAssertEqual(timer.timeInterval, interval)
6060

6161
let currentInterval = Date().timeIntervalSince1970
62-
XCTAssertEqualWithAccuracy(currentInterval, previousInterval + interval, accuracy: 0.01)
62+
XCTAssertEqual(currentInterval, previousInterval + interval, accuracy: 0.01)
6363
previousInterval = currentInterval
6464

6565
flag += 1

TestFoundation/TestProgress.swift

+30-30
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TestProgress : XCTestCase {
4444

4545
// Test self
4646
parent.completedUnitCount = 50
47-
XCTAssertEqualWithAccuracy(0.5, parent.fractionCompleted, accuracy: 0.01)
47+
XCTAssertEqual(0.5, parent.fractionCompleted, accuracy: 0.01)
4848

4949
parent.completedUnitCount = 0
5050
// Test child
@@ -53,24 +53,24 @@ class TestProgress : XCTestCase {
5353
child1.completedUnitCount = 50
5454

5555
// half of 10% is done in parent
56-
XCTAssertEqualWithAccuracy(0.05, parent.fractionCompleted, accuracy: 0.01)
57-
XCTAssertEqualWithAccuracy(0.5, child1.fractionCompleted, accuracy: 0.01)
56+
XCTAssertEqual(0.05, parent.fractionCompleted, accuracy: 0.01)
57+
XCTAssertEqual(0.5, child1.fractionCompleted, accuracy: 0.01)
5858

5959
// Up the total amount of work
6060
parent.totalUnitCount = 200
6161

62-
XCTAssertEqualWithAccuracy(0.5 * (10.0 / 200.0) /* 0.025 */, parent.fractionCompleted, accuracy: 0.01)
63-
XCTAssertEqualWithAccuracy(0.5, child1.fractionCompleted, accuracy: 0.01)
62+
XCTAssertEqual(0.5 * (10.0 / 200.0) /* 0.025 */, parent.fractionCompleted, accuracy: 0.01)
63+
XCTAssertEqual(0.5, child1.fractionCompleted, accuracy: 0.01)
6464

6565
// Change the total in the child, doubling total amount of work
6666
child1.totalUnitCount = 200
67-
XCTAssertEqualWithAccuracy(50.0 / 200.0, child1.fractionCompleted, accuracy: 0.01)
68-
XCTAssertEqualWithAccuracy((50.0 / 200.0) * (10.0 / 200), parent.fractionCompleted, accuracy: 0.01)
67+
XCTAssertEqual(50.0 / 200.0, child1.fractionCompleted, accuracy: 0.01)
68+
XCTAssertEqual((50.0 / 200.0) * (10.0 / 200), parent.fractionCompleted, accuracy: 0.01)
6969

7070
// Change the total in the child, the other direction, halving the amount of work
7171
child1.totalUnitCount = 100
72-
XCTAssertEqualWithAccuracy(50.0 / 100.0, child1.fractionCompleted, accuracy: 0.01)
73-
XCTAssertEqualWithAccuracy((50.0 / 100.0) * (10.0 / 200), parent.fractionCompleted, accuracy: 0.01)
72+
XCTAssertEqual(50.0 / 100.0, child1.fractionCompleted, accuracy: 0.01)
73+
XCTAssertEqual((50.0 / 100.0) * (10.0 / 200), parent.fractionCompleted, accuracy: 0.01)
7474
}
7575

7676
func test_multipleChildren() {
@@ -84,19 +84,19 @@ class TestProgress : XCTestCase {
8484
let child1 = Progress(totalUnitCount: 5)
8585
let child2 = Progress(totalUnitCount: 5)
8686

87-
XCTAssertEqualWithAccuracy(progress.fractionCompleted, 0, accuracy: 0.01)
87+
XCTAssertEqual(progress.fractionCompleted, 0, accuracy: 0.01)
8888

8989
child2.completedUnitCount = 5
9090

9191
// Child2 does not affect the parent's fraction completed (it should only be child1 that makes a difference)
92-
XCTAssertEqualWithAccuracy(progress.fractionCompleted, 0, accuracy: 0.01)
92+
XCTAssertEqual(progress.fractionCompleted, 0, accuracy: 0.01)
9393

9494
let _ = Progress(totalUnitCount: 5)
95-
XCTAssertEqualWithAccuracy(progress.fractionCompleted, 0, accuracy: 0.01)
95+
XCTAssertEqual(progress.fractionCompleted, 0, accuracy: 0.01)
9696

9797
// Update child #1
9898
child1.completedUnitCount = 5
99-
XCTAssertEqualWithAccuracy(progress.fractionCompleted, 1.0, accuracy: 0.01)
99+
XCTAssertEqual(progress.fractionCompleted, 1.0, accuracy: 0.01)
100100
}
101101

102102
func test_indeterminateChildrenAffectFractionCompleted() {
@@ -107,23 +107,23 @@ class TestProgress : XCTestCase {
107107
let child1 = Progress(totalUnitCount: 10)
108108

109109
child1.completedUnitCount = 5
110-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.05, accuracy: 0.01)
110+
XCTAssertEqual(parent.fractionCompleted, 0.05, accuracy: 0.01)
111111

112112
// Child1 becomes indeterminate
113113
child1.completedUnitCount = -1
114-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.0, accuracy: 0.01)
114+
XCTAssertEqual(parent.fractionCompleted, 0.0, accuracy: 0.01)
115115

116116
// Become determinate
117117
// childProgress1's completed unit count is 100% of its total of 10 (10)
118118
// childProgress1 is 10% of the overall unit count (100 / 1000)
119119
// the overall count done should be 100% of 10% of 1000, or 1.0 * 0.1 * 1000 = 100
120120
// the overall percentage done should be 100 / 1000 = 0.1
121121
child1.completedUnitCount = 10
122-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.1, accuracy: 0.01)
122+
XCTAssertEqual(parent.fractionCompleted, 0.1, accuracy: 0.01)
123123

124124
// Become indeterminate again
125125
child1.completedUnitCount = -1
126-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.0, accuracy: 0.01)
126+
XCTAssertEqual(parent.fractionCompleted, 0.0, accuracy: 0.01)
127127

128128
parent.resignCurrent()
129129
}
@@ -140,21 +140,21 @@ class TestProgress : XCTestCase {
140140
let child2 = Progress(totalUnitCount: 2)
141141
parent.resignCurrent()
142142

143-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.0, accuracy: 0.01)
143+
XCTAssertEqual(parent.fractionCompleted, 0.0, accuracy: 0.01)
144144

145145
child1.completedUnitCount = 1
146146
child2.completedUnitCount = 1
147147

148148
// half done
149-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.5, accuracy: 0.01)
149+
XCTAssertEqual(parent.fractionCompleted, 0.5, accuracy: 0.01)
150150

151151
// Move a child to indeterminate
152152
child1.completedUnitCount = -1
153-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.25, accuracy: 0.01)
153+
XCTAssertEqual(parent.fractionCompleted, 0.25, accuracy: 0.01)
154154

155155
// Move it back to determinate
156156
child1.completedUnitCount = 1
157-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 0.5, accuracy: 0.01)
157+
XCTAssertEqual(parent.fractionCompleted, 0.5, accuracy: 0.01)
158158
}
159159

160160
func test_childCompletionFinishesGroups() {
@@ -166,10 +166,10 @@ class TestProgress : XCTestCase {
166166
root.addChild(child2, withPendingUnitCount: 1)
167167

168168
child1.completedUnitCount = 1
169-
XCTAssertEqualWithAccuracy(root.fractionCompleted, 0.5, accuracy: 0.01)
169+
XCTAssertEqual(root.fractionCompleted, 0.5, accuracy: 0.01)
170170

171171
child2.completedUnitCount = 1
172-
XCTAssertEqualWithAccuracy(root.fractionCompleted, 1.0, accuracy: 0.01)
172+
XCTAssertEqual(root.fractionCompleted, 1.0, accuracy: 0.01)
173173
XCTAssertEqual(root.completedUnitCount, 2)
174174
}
175175

@@ -296,38 +296,38 @@ class TestProgress : XCTestCase {
296296

297297
// child1 is half done. This means the parent is half of 1/3 done.
298298
child1.completedUnitCount = 5
299-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, (1.0 / 3.0) / 2.0, accuracy: 0.01)
299+
XCTAssertEqual(parent.fractionCompleted, (1.0 / 3.0) / 2.0, accuracy: 0.01)
300300

301301
// child2 is half done. This means the parent is (half of 1/3 done) + (half of 1/3 done).
302302
child2.completedUnitCount = 5
303-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) * 2.0, accuracy: 0.01)
303+
XCTAssertEqual(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) * 2.0, accuracy: 0.01)
304304

305305
// add an implict child
306306
parent.becomeCurrent(withPendingUnitCount: 1)
307307
let child3 = Progress(totalUnitCount: 10)
308308
parent.resignCurrent()
309309

310310
// Total completed of parent should not change
311-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) * 2.0, accuracy: 0.01)
311+
XCTAssertEqual(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) * 2.0, accuracy: 0.01)
312312

313313
// child3 is half done. This means the parent is (half of 1/3 done) * 3.
314314
child3.completedUnitCount = 5
315-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) * 3.0, accuracy: 0.01)
315+
XCTAssertEqual(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) * 3.0, accuracy: 0.01)
316316

317317
// Finish child3
318318
child3.completedUnitCount = 10
319319
XCTAssertTrue(child3.isFinished)
320-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, (((1.0 / 3.0) / 2.0) * 2.0) + (1.0 / 3.0), accuracy: 0.01)
320+
XCTAssertEqual(parent.fractionCompleted, (((1.0 / 3.0) / 2.0) * 2.0) + (1.0 / 3.0), accuracy: 0.01)
321321

322322
// Finish child2
323323
child2.completedUnitCount = 10;
324324
XCTAssertTrue(child2.isFinished)
325-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) + ((1.0 / 3.0) * 2.0), accuracy: 0.01)
325+
XCTAssertEqual(parent.fractionCompleted, ((1.0 / 3.0) / 2.0) + ((1.0 / 3.0) * 2.0), accuracy: 0.01)
326326

327327
// Finish child1
328328
child1.completedUnitCount = 10;
329329
XCTAssertTrue(child1.isFinished)
330-
XCTAssertEqualWithAccuracy(parent.fractionCompleted, 1.0, accuracy: 0.01)
330+
XCTAssertEqual(parent.fractionCompleted, 1.0, accuracy: 0.01)
331331
XCTAssertTrue(parent.isFinished)
332332
XCTAssertEqual(parent.completedUnitCount, parent.totalUnitCount)
333333

0 commit comments

Comments
 (0)