File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -2380,7 +2380,8 @@ StringTests.test("String.CoW.reserveCapacity") {
23802380 let preGrowCapacity = str. capacity
23812381
23822382 // Growth shouldn't be linear
2383- str. append ( contentsOf: String ( repeating: " z " , count: 20 ) )
2383+ let newElementCount = ( preGrowCapacity - str. count) + 10
2384+ str. append ( contentsOf: String ( repeating: " z " , count: newElementCount) )
23842385 expectGE ( str. capacity, preGrowCapacity * 2 )
23852386
23862387 // Capacity can shrink when copying, but not below the count
@@ -2407,7 +2408,6 @@ StringTests.test("NSString.CoW.reserveCapacity") {
24072408 var copy2 = str2
24082409 copy2. append ( contentsOf: String ( repeating: " z " , count: 10 ) )
24092410 expectGE ( copy2. capacity, 30 )
2410- expectLT ( copy2. capacity, 40 )
24112411#endif
24122412}
24132413
You can’t perform that action at this time.
0 commit comments