File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,14 @@ final class TaskSchedulerTests: XCTestCase {
3939 }
4040 } ,
4141 validate: { ( recordings: [ Set < TaskID > ] ) in
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)
42+ // Check that all high-priority tasks start executing before the first low-priority task finishes
43+ var startedLowPriorityTasks : Set < TaskID > = [ ]
44+ let highPriorityRecordingSlice = recordings. prefix ( while: { recording in
45+ if startedLowPriorityTasks. contains ( where: { !recording. contains ( $0) } ) {
46+ return false
47+ }
48+ startedLowPriorityTasks. formUnion ( recording. filter ( \. isLowPriority) )
49+ return true
4550 } )
4651 let taskIdsInHighPriorityRecordingSlice = Set ( highPriorityRecordingSlice. flatMap { $0 } )
4752 XCTAssert (
You can’t perform that action at this time.
0 commit comments