@@ -44,7 +44,7 @@ class TestProgress : XCTestCase {
44
44
45
45
// Test self
46
46
parent. completedUnitCount = 50
47
- XCTAssertEqualWithAccuracy ( 0.5 , parent. fractionCompleted, accuracy: 0.01 )
47
+ XCTAssertEqual ( 0.5 , parent. fractionCompleted, accuracy: 0.01 )
48
48
49
49
parent. completedUnitCount = 0
50
50
// Test child
@@ -53,24 +53,24 @@ class TestProgress : XCTestCase {
53
53
child1. completedUnitCount = 50
54
54
55
55
// 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 )
58
58
59
59
// Up the total amount of work
60
60
parent. totalUnitCount = 200
61
61
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 )
64
64
65
65
// Change the total in the child, doubling total amount of work
66
66
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 )
69
69
70
70
// Change the total in the child, the other direction, halving the amount of work
71
71
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 )
74
74
}
75
75
76
76
func test_multipleChildren( ) {
@@ -84,19 +84,19 @@ class TestProgress : XCTestCase {
84
84
let child1 = Progress ( totalUnitCount: 5 )
85
85
let child2 = Progress ( totalUnitCount: 5 )
86
86
87
- XCTAssertEqualWithAccuracy ( progress. fractionCompleted, 0 , accuracy: 0.01 )
87
+ XCTAssertEqual ( progress. fractionCompleted, 0 , accuracy: 0.01 )
88
88
89
89
child2. completedUnitCount = 5
90
90
91
91
// 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 )
93
93
94
94
let _ = Progress ( totalUnitCount: 5 )
95
- XCTAssertEqualWithAccuracy ( progress. fractionCompleted, 0 , accuracy: 0.01 )
95
+ XCTAssertEqual ( progress. fractionCompleted, 0 , accuracy: 0.01 )
96
96
97
97
// Update child #1
98
98
child1. completedUnitCount = 5
99
- XCTAssertEqualWithAccuracy ( progress. fractionCompleted, 1.0 , accuracy: 0.01 )
99
+ XCTAssertEqual ( progress. fractionCompleted, 1.0 , accuracy: 0.01 )
100
100
}
101
101
102
102
func test_indeterminateChildrenAffectFractionCompleted( ) {
@@ -107,23 +107,23 @@ class TestProgress : XCTestCase {
107
107
let child1 = Progress ( totalUnitCount: 10 )
108
108
109
109
child1. completedUnitCount = 5
110
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.05 , accuracy: 0.01 )
110
+ XCTAssertEqual ( parent. fractionCompleted, 0.05 , accuracy: 0.01 )
111
111
112
112
// Child1 becomes indeterminate
113
113
child1. completedUnitCount = - 1
114
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.0 , accuracy: 0.01 )
114
+ XCTAssertEqual ( parent. fractionCompleted, 0.0 , accuracy: 0.01 )
115
115
116
116
// Become determinate
117
117
// childProgress1's completed unit count is 100% of its total of 10 (10)
118
118
// childProgress1 is 10% of the overall unit count (100 / 1000)
119
119
// the overall count done should be 100% of 10% of 1000, or 1.0 * 0.1 * 1000 = 100
120
120
// the overall percentage done should be 100 / 1000 = 0.1
121
121
child1. completedUnitCount = 10
122
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.1 , accuracy: 0.01 )
122
+ XCTAssertEqual ( parent. fractionCompleted, 0.1 , accuracy: 0.01 )
123
123
124
124
// Become indeterminate again
125
125
child1. completedUnitCount = - 1
126
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.0 , accuracy: 0.01 )
126
+ XCTAssertEqual ( parent. fractionCompleted, 0.0 , accuracy: 0.01 )
127
127
128
128
parent. resignCurrent ( )
129
129
}
@@ -140,21 +140,21 @@ class TestProgress : XCTestCase {
140
140
let child2 = Progress ( totalUnitCount: 2 )
141
141
parent. resignCurrent ( )
142
142
143
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.0 , accuracy: 0.01 )
143
+ XCTAssertEqual ( parent. fractionCompleted, 0.0 , accuracy: 0.01 )
144
144
145
145
child1. completedUnitCount = 1
146
146
child2. completedUnitCount = 1
147
147
148
148
// half done
149
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.5 , accuracy: 0.01 )
149
+ XCTAssertEqual ( parent. fractionCompleted, 0.5 , accuracy: 0.01 )
150
150
151
151
// Move a child to indeterminate
152
152
child1. completedUnitCount = - 1
153
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.25 , accuracy: 0.01 )
153
+ XCTAssertEqual ( parent. fractionCompleted, 0.25 , accuracy: 0.01 )
154
154
155
155
// Move it back to determinate
156
156
child1. completedUnitCount = 1
157
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 0.5 , accuracy: 0.01 )
157
+ XCTAssertEqual ( parent. fractionCompleted, 0.5 , accuracy: 0.01 )
158
158
}
159
159
160
160
func test_childCompletionFinishesGroups( ) {
@@ -166,10 +166,10 @@ class TestProgress : XCTestCase {
166
166
root. addChild ( child2, withPendingUnitCount: 1 )
167
167
168
168
child1. completedUnitCount = 1
169
- XCTAssertEqualWithAccuracy ( root. fractionCompleted, 0.5 , accuracy: 0.01 )
169
+ XCTAssertEqual ( root. fractionCompleted, 0.5 , accuracy: 0.01 )
170
170
171
171
child2. completedUnitCount = 1
172
- XCTAssertEqualWithAccuracy ( root. fractionCompleted, 1.0 , accuracy: 0.01 )
172
+ XCTAssertEqual ( root. fractionCompleted, 1.0 , accuracy: 0.01 )
173
173
XCTAssertEqual ( root. completedUnitCount, 2 )
174
174
}
175
175
@@ -296,38 +296,38 @@ class TestProgress : XCTestCase {
296
296
297
297
// child1 is half done. This means the parent is half of 1/3 done.
298
298
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 )
300
300
301
301
// child2 is half done. This means the parent is (half of 1/3 done) + (half of 1/3 done).
302
302
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 )
304
304
305
305
// add an implict child
306
306
parent. becomeCurrent ( withPendingUnitCount: 1 )
307
307
let child3 = Progress ( totalUnitCount: 10 )
308
308
parent. resignCurrent ( )
309
309
310
310
// 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 )
312
312
313
313
// child3 is half done. This means the parent is (half of 1/3 done) * 3.
314
314
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 )
316
316
317
317
// Finish child3
318
318
child3. completedUnitCount = 10
319
319
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 )
321
321
322
322
// Finish child2
323
323
child2. completedUnitCount = 10 ;
324
324
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 )
326
326
327
327
// Finish child1
328
328
child1. completedUnitCount = 10 ;
329
329
XCTAssertTrue ( child1. isFinished)
330
- XCTAssertEqualWithAccuracy ( parent. fractionCompleted, 1.0 , accuracy: 0.01 )
330
+ XCTAssertEqual ( parent. fractionCompleted, 1.0 , accuracy: 0.01 )
331
331
XCTAssertTrue ( parent. isFinished)
332
332
XCTAssertEqual ( parent. completedUnitCount, parent. totalUnitCount)
333
333
0 commit comments