We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3677d8e commit acfc744Copy full SHA for acfc744
validation-test/stdlib/Arrays.swift.gyb
@@ -233,6 +233,15 @@ ArrayTestSuite.test("${array_type}/appendNonUnique") {
233
}
234
235
236
+ArrayTestSuite.test("${array_type}/appendUndercountedCollection") {
237
+ // test that the array safely handles a
238
+ // collection that understates its count
239
+ var i = 0
240
+ let l = repeatElement(42, count: 10_000).lazy.filter { _ in i += 1; return i > 10_000 }
241
+ var a: ${array_type}<Int> = []
242
+ a.append(contentsOf: l)
243
+}
244
+
245
ArrayTestSuite.test("${array_type}/emptyAllocation") {
246
let arr0 = ${array_type}<Int>()
247
let arr1 = ${array_type}<LifetimeTracked>(repeating: LifetimeTracked(0), count: 0)
0 commit comments