@@ -184,19 +184,21 @@ struct TestConfig {
184
184
skipTags: Set < BenchmarkCategory >
185
185
) -> [ ( index: String , info: BenchmarkInfo ) ] {
186
186
let indices = Dictionary ( uniqueKeysWithValues:
187
- zip ( registeredBenchmarks. sorted ( ) . map { $0. name } ,
187
+ zip ( registeredBenchmarks. sorted ( ) . map { $0. name } ,
188
188
( 1 ... ) . lazy. map { String ( $0) } ) )
189
- let benchmarkNamesOrIndices = Set ( filters)
189
+ let specifiedTests = Set ( filters)
190
190
191
- return registeredBenchmarks. filter { benchmark in
192
- if benchmarkNamesOrIndices. isEmpty {
193
- return benchmark. tags. isSuperset ( of: tags) &&
194
- benchmark. tags. isDisjoint ( with: skipTags)
195
- } else {
196
- return benchmarkNamesOrIndices. contains ( benchmark. name) ||
197
- benchmarkNamesOrIndices. contains ( indices [ benchmark. name] !)
198
- }
199
- } . map { ( index: indices [ $0. name] !, info: $0) }
191
+ func byTags( b: BenchmarkInfo ) -> Bool {
192
+ return b. tags. isSuperset ( of: tags) &&
193
+ b. tags. isDisjoint ( with: skipTags)
194
+ }
195
+ func byNamesOrIndices( b: BenchmarkInfo ) -> Bool {
196
+ return specifiedTests. contains ( b. name) ||
197
+ specifiedTests. contains ( indices [ b. name] !)
198
+ } // !! "All registeredBenchmarks have been assigned an index"
199
+ return registeredBenchmarks
200
+ . filter ( filters. isEmpty ? byTags : byNamesOrIndices)
201
+ . map { ( index: indices [ $0. name] !, info: $0) }
200
202
}
201
203
}
202
204
0 commit comments