11// Successful match FSPaths
2- private let fsPathSuccess = #"""
2+ private let pathSuccess = #"""
33./First/Second/Third/some/really/long/content.extension/more/stuff/OptionLeft
44./First/Second/Third/some/really/long/content.extension/more/stuff/OptionRight
55./First/Second/PrefixThird/some/really/long/content.extension/more/stuff/OptionLeft
@@ -10,7 +10,7 @@ private let fsPathSuccess = #"""
1010//
1111// We will have far more failures than successful matches by interspersing
1212// this whole list between each success
13- private let fsPathFailure = #"""
13+ private let pathFailure = #"""
1414a/b/c
1515/smol/path
1616/a/really/long/path/that/is/certainly/stored/out/of/line
@@ -28,24 +28,43 @@ a/b/c
2828./First/Second/PrefixThird/some/really/long/content/more/stuff/OptionRight
2929"""#
3030
31+ private func listify( _ s: String ) -> [ String ] {
32+ s. split ( whereSeparator: { $0. isNewline } ) . map { String ( $0) }
33+ }
34+
35+ private let pathSuccessList : [ String ] = { listify ( pathSuccess) } ( )
36+ private let pathFailureList : [ String ] = { listify ( pathFailure) } ( )
37+
38+ private func scale( _ input: [ String ] ) -> [ String ] {
39+ let threshold = 1_000
40+ var result = input
41+ while result. count < threshold {
42+ result. append ( contentsOf: input)
43+ }
44+ return result
45+ }
46+
3147extension Inputs {
3248 static let fsPathsList : [ String ] = {
33- var result : [ String ] = [ ]
34- let failures : [ String ] = fsPathFailure. split ( whereSeparator: { $0. isNewline } ) . map { String ( $0) }
35- result. append ( contentsOf: failures)
49+ var result = pathFailureList
50+ result. append ( contentsOf: pathFailureList)
3651
37- for success in fsPathSuccess . split ( whereSeparator : { $0 . isNewline } ) {
52+ for success in pathSuccessList {
3853 result. append ( String ( success) )
39- result. append ( contentsOf: failures)
54+ result. append ( contentsOf: pathFailureList)
55+ result. append ( contentsOf: pathFailureList)
4056 }
4157
4258 // Scale result up a bit
43- result. append ( contentsOf: result)
44- result. append ( contentsOf: result)
45- result. append ( contentsOf: result)
46- result. append ( contentsOf: result)
59+ return scale ( result)
60+
61+ } ( )
4762
48- return result
63+ static let fsPathsNotFoundList : [ String ] = {
64+ scale ( pathFailureList)
65+ } ( )
4966
67+ static let fsPathsFoundList : [ String ] = {
68+ scale ( pathFailureList)
5069 } ( )
5170}
0 commit comments