File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,15 @@ final class TaskSchedulerTests: XCTestCase {
3939 }
4040 } ,
4141 validate: { ( recordings: [ Set < TaskID > ] ) in
42- // Check that all high-priority tasks get executed before the low-priority tasks
43- let highPriorityRecordingSlice = recordings. dropLast ( while: {
44- $0. isEmpty || $0. contains ( where: \. isLowPriority )
42+ // Check that all high-priority tasks start executing before the low-priority tasks
43+ let highPriorityRecordingSlice = recordings. prefix ( while: {
44+ $0. isEmpty || $0. contains ( where: \. isHighPriority )
4545 } )
46- assertAllSatisfy ( highPriorityRecordingSlice) { !$0. contains ( where: \. isLowPriority) }
46+ let taskIdsInHighPriorityRecordingSlice = Set ( highPriorityRecordingSlice. flatMap { $0 } )
47+ XCTAssert (
48+ taskIdsInHighPriorityRecordingSlice. isSuperset ( of: ( 0 ..< 10 ) . map ( TaskID . highPriority) ) ,
49+ " Low priority task started executing before high-priority task. Recording: \( recordings) "
50+ )
4751
4852 // Check that we never have more than the allowed number of low/high priority tasks, respectively
4953 assertAllSatisfy ( recordings) { $0. count ( where: \. isLowPriority) <= lowPriorityTasks }
You can’t perform that action at this time.
0 commit comments