Commit Graph
50 Commits
Author SHA1 Message Date
Karoy Lorentey f9a6df8a55 [_RopeModule] Fix infinite loop while hashing the UTF-8 view of a multi-chunk big substring 2026-04-30 15:29:22 -07:00
Karoy Lorentey 1c69635852 Add SPDX-License-Identifier tags 2026-03-05 19:39:24 -08:00
Karoy Lorentey d9b09ecde8 Update copyright dates 2026-03-05 19:39:20 -08:00
Karoy Lorentey cd309d5a1f Speed up testing by default 2026-01-20 10:54:31 -08:00
Alejandro Alonso a9bfbeac39 Conditionalize big string sources on 6.2 compiler
add some more
2025-09-30 09:04:52 -07:00
Alejandro Alonso 235030c10b Refactor BigString._Chunk to be its own managed buffer of UTF8 2025-09-30 09:04:19 -07:00
Karoy Lorentey 336567b6dd Silence very helpful concurrency error on stdout/stderr access 2025-08-17 21:18:15 -07:00
Karoy Lorentey 5f03d1bc24 Adopt availability macros 2025-08-17 13:23:01 -07:00
Karoy Lorentey 54c65310f4 Adopt #filePath in test assertions 2025-08-17 13:23:00 -07:00
Karoy Lorentey 96a16f6dc1 [BigString] Add new tests exercising broken indexing operations 2025-06-17 17:27:58 -07:00
Karoy Lorentey c25a388c13 [Rope] Avoid calling String.Index._description
On recent enough stdlibs, we can now just print the index directly to get the same effect.
2025-05-16 11:02:52 -07:00
Karoy Lorentey e4cd17cc53 Remove support code for outdated toolchains 2024-09-25 14:14:48 -07:00
Karoy Lorentey 6c31865359 [test] Add tests for Rope.join’s copy-on-write behavior 2024-05-31 16:59:25 -07:00
Dimitris Apostolou 7539583245 Fix typos
# Conflicts:
#	Sources/SortedCollections/BTree/_BTree+BidirectionalCollection.swift
#	Sources/SortedCollections/BTree/_BTree+UnsafeCursor.swift
#	Sources/SortedCollections/BTree/_BTree.Builder.swift
#	Sources/SortedCollections/BTree/_BTree.swift
#	Sources/SortedCollections/BTree/_Node.Splinter.swift
#	Sources/SortedCollections/BTree/_Node.Storage.swift
#	Sources/SortedCollections/BTree/_Node.UnsafeHandle+Insertion.swift
#	Sources/SortedCollections/BTree/_Node.swift
#	Tests/SortedCollectionsTests/BTree/Node+Join Tests.swift
2024-02-06 15:52:26 -08:00
Karoy Lorentey ffa4a58bc1 Update remaining copyright notices 2024-02-02 16:20:22 -08:00
Karoy Lorentey 03e7f0c401 [Rope] Fix find to return a zero remainder for the end position 2023-06-02 17:37:30 -07:00
Karoy Lorentey 03c9ef743a [Rope] Fix crash when calling replaceSubrange/removeSubrange on an empty rope 2023-06-01 20:24:24 -07:00
Karoy Lorentey 374c3a4805 Migrate rope tests to CollectionsTestSupport assertions 2023-06-01 20:23:49 -07:00
Karoy Lorentey a5fda7c368 [RopeModule] Reduce test workload on watchOS 2023-05-18 18:42:54 -07:00
Karoy Lorentey 3fa52c48de [Rope] Add remove(at:), remove(at:in:) variants that preserve the position 2023-04-13 19:36:09 -07:00
Karoy Lorentey cead2b3d64 [Rope] index(_:offsetBy:in:preferEnd:) fix result tuple labeling
This renames `remainder` to `remaining`, restoring API consistency.
2023-04-12 17:54:13 -07:00
Karoy Lorentey ea60d293b4 Fix test issues with single-module variant 2023-03-21 18:43:46 -07:00
Karoy Lorentey cbab9e3737 Introduce COLLECTIONS_SINGLE_MODULE condition 2023-03-21 18:42:33 -07:00
Karoy Lorentey fcd6800b9d BigString: Slightly speed up a slow test 2023-03-21 11:42:56 -07:00
Karoy Lorentey 8394ea7575 Clean up test definitions 2023-03-21 01:30:03 -07:00
Karoy Lorentey ad82bc3f80 Naming review 2023-03-21 01:21:43 -07:00
Karoy Lorentey 88286b661d BigString: Fix Issue in utf16.distance when endpoint is on the trailing surrogate of the first scalar in a chunk 2023-03-21 01:04:12 -07:00
Karoy Lorentey 6f3f19d1c5 _Rope → Rope 2023-03-20 23:49:57 -07:00
Karoy Lorentey 0ad7f0ce38 _BString → BigString 2023-03-20 21:20:30 -07:00
Karoy Lorentey 706be4d9df Also, don’t forget to call super.setUp 2023-03-20 19:54:44 -07:00
Karoy Lorentey 44cff40712 Work around SPM limitations around test case availability 💗 2023-03-20 19:34:52 -07:00
Karoy Lorentey b022b7fee5 Make _BString and _Rope public 2023-03-20 18:36:37 -07:00
Karoy Lorentey 09577a31ee RopeModule→_RopeModule. Stop reexporting it from Collections.
This module is not source stable; mark it as such by prepending
the module name with an underscore.
2023-03-20 16:47:56 -07:00
Karoy Lorentey 4849d54675 Add a compile-time conditional for enabling randomized testing, enabled by default 2023-03-20 13:12:14 -07:00
Karoy Lorentey b50fb5aab5 _BString.resolve: Don’t crash when resolving indices in the empty string 2023-03-20 13:12:14 -07:00
Karoy Lorentey b355480eb7 _BString: Make unicodeScalars properties mutable 2023-03-20 13:12:13 -07:00
Karoy Lorentey b8927d819b BigString: Flesh out views, make them consistent with _BString 2023-03-20 13:12:13 -07:00
Karoy Lorentey d79a752fc8 _BString: Review views & add missing functionality/shortcuts 2023-03-20 13:12:13 -07:00
Karoy Lorentey 033bf17f9d _BString: Add UTF-8 and UTF-16 index rounding tests
UTF-16 index rounding is a semantic mess; the behavior is emulating
the stdlib, and it seems far more useful than if we went with a
semantically consistent definition.
2023-03-20 13:12:13 -07:00
Karoy Lorentey 22113290f1 _BString: Adjust substring mutation test to actually exercise Unicode weirdness 2023-03-20 13:12:13 -07:00
Karoy Lorentey 05f8f9b887 _BString: Modernize tests 2023-03-20 13:12:12 -07:00
Karoy Lorentey a10439bc32 _BString, _BSubstring: Merge character views into top-level types. Add RangeReplaceableCollection conformances.
This emulates the standard String.
2023-03-20 13:12:12 -07:00
Karoy Lorentey eda72e344f _BString: Fix character index rounding; use it when accessing character data
Oops, `_BString.subscript(character:)` failed to round down to a character boundary before trying to access the addressed character. It also resolved the index with `preferEnd` set to true, which isn’t what we actually want.
2023-03-20 13:12:12 -07:00
Karoy Lorentey 28727f7c56 _BString: Implement views
Having all core functionality exposed by the top-level type is not a bad idea; unfortunately substrings are tricky to get right, so it’s better to implement that out of the box.
2023-03-20 13:12:11 -07:00
Karoy Lorentey 3cc5a3888a _Rope: Add a leaf node reference to indices. Implement explicit index invalidation 2023-03-20 13:12:09 -07:00
Karoy Lorentey 8c1740ad28 _Rope.Index: Merge height into UInt64 storage.
This leaves 56 bits for path data, which should still be plenty.
(We want to allow big strings to grow to 2^48 UTF-8 code units, to
match the standard String; however, there is no practical need to
support any more, and even that is a stretch.)

Add tests to verify that the tree capacity matches expectations
in Release builds. (In Debug builds, we limit the maximum node size,
which drastically reduces capacity. This is okay.)
2023-03-20 13:12:09 -07:00
Karoy Lorentey 8c8cb5622b Restrict BIgString and _BString to Swift 5.8 and macOS 13.3 /iOS 16.4/etc
These types heavily rely on stdlib functionality that ships in
Swift 5.8; they do not run correctly on earlier releases.
2023-03-20 13:12:09 -07:00
Karoy Lorentey 18aa309f75 Generalize some _BString iterators 2023-03-20 13:12:07 -07:00
Karoy Lorentey eabd941799 Add some operations taking subsequences 2023-03-20 13:12:07 -07:00
Karoy Lorentey 150a165d73 Add experimental rope implementation 2023-03-20 13:11:21 -07:00