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") {
2380
2380
let preGrowCapacity = str. capacity
2381
2381
2382
2382
// 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) )
2384
2385
expectGE ( str. capacity, preGrowCapacity * 2 )
2385
2386
2386
2387
// Capacity can shrink when copying, but not below the count
@@ -2407,7 +2408,6 @@ StringTests.test("NSString.CoW.reserveCapacity") {
2407
2408
var copy2 = str2
2408
2409
copy2. append ( contentsOf: String ( repeating: " z " , count: 10 ) )
2409
2410
expectGE ( copy2. capacity, 30 )
2410
- expectLT ( copy2. capacity, 40 )
2411
2411
#endif
2412
2412
}
2413
2413
You can’t perform that action at this time.
0 commit comments