mirror of
https://github.com/apple/swift-collections
synced 2026-11-30 05:18:44 +00:00
#113 switched `append(contentsOf:)` to exponential capacity reservation without adding tests. This covers Deque's allocation behavior: - Implement the empty `test_reserveCapacity` stub: reservations grow storage linearly to exactly the requested capacity, never shrink it, and leave sufficiently large unique storage in place. - Initializers with a known element count allocate exactly that much. - Single-element insertions follow the same capacity sequence as `UniqueDeque`. - Repeated bulk insertions (append/prepend/insert/replaceSubrange, from contiguous arrays, collections and sequences) grow storage by a constant factor rather than reallocating on each call. - Reserved capacity is used without reallocating. - Inserting into shared storage keeps capacity when there is room and otherwise grows it by the same factor, leaving the original untouched. Resolves #129. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016NTKVRe3aXMteHVrhbrTYE
Unit tests
Beware! The contents of this directory are not source stable. They are provided as is, with no compatibility promises across package releases. Future versions of this package can arbitrarily change these files or remove them, without any advance notice. (This can include patch releases.)