Commit Graph
28 Commits
Author SHA1 Message Date
Karoy Lorentey 706be4d9df Also, don’t forget to call super.setUp 2023-03-20 19:54:44 -07:00
Karoy Lorentey 24e58e86fc Don’t override XCTestCase.invokeTest on non-Darwin systems 2023-03-20 19:49:42 -07:00
Karoy Lorentey 44cff40712 Work around SPM limitations around test case availability 💗 2023-03-20 19:34:52 -07:00
Karoy Lorentey b8ef14f0c0 ShareableHashedCollections → HashTreeCollections 2022-11-28 21:35:37 -08:00
Karoy Lorentey e8fc3ee4cd [PersistentCollections] Rename to SharableHashedCollections
`PersistentSet` → `ShareableSet`
`PersistentDictionary` → `ShareableDictionary`
`PersistentCollections` → `ShareableHashedCollections`
2022-11-07 18:10:16 -08:00
Karoy Lorentey 8f7d5fd505 [SetAlgebra types] isEqual(to:) → isEqualSet(to:)
The `isEqual(to:)` methods are a bit too confusing — they implement
mathematical set comparisons (ignoring element ordering and, in the
case of the Sequence variant, even element multiplicities), so it
seems better to highlight this by putting a `Set` in the name.
2022-10-31 15:05:12 -07:00
Karoy Lorentey 84356e58c7 [PersistentCollection] Back out BidirectionalCollection conformance
BidirectionalCollection has the connotation that the ordering
of elements is meaningful, which isn’t the case for PersistentSet
and PersistentDictionary.
2022-10-27 18:08:27 -07:00
Karoy Lorentey 4fcb37f6ac [_CollectionsUtilities] Adjust DictionaryAPIChecker 2022-10-21 19:49:20 -07:00
Karoy Lorentey 51a1554f89 Introduce _UniqueCollection & _SortedCollection
These marker-like protocols will allow certain
generic operations to get a performance boost
if the passed-in value happens to be guaranteed
to contain unique elements or to be sorted.

Also, review API checker protocols for Sets and
sorted collections and adjust things as needed.

BitSet gains custom implementations for min()
and max() as part of these improvements.
2022-10-19 01:40:06 -07:00
Karoy Lorentey 02ea4e8492 [_CollectionsTestSupport] Move StringConvertibleValue under Utilities 2022-10-18 21:44:24 -07:00
Karoy Lorentey 2e9447fb1c [_CollectionsTestSupport] Richer support for combinatorial testing 2022-10-13 15:45:08 -07:00
Karoy Lorentey 6286cd0b99 Restore support for building with Swift 5.5
This is mostly about adding more type declarations to deal with type checker limitations in the older compiler.
This also includes workarounds that allow better support for CodingKeyRepresentable in PersistentDictionary, and it fixes a couple of small oversights on various #else branches.
2022-10-10 18:07:49 -07:00
Karoy Lorentey 0b86bb11d2 [PersistentSet] Flesh out API surface
Add customary overloads for high-level Set operations.
2022-10-09 15:26:32 -07:00
Karoy Lorentey 4604c1bc38 [test] Add SetAPIChecker protocol
This is useful for validating the API surface of set-like types,
ensuring that we haven’t forgotten to implement members that
are part of users’ baseline expectations.

To ensure maximum utility, this protocol refines neither Collection
nor SetAlgebra.
2022-10-09 13:33:23 -07:00
Karoy Lorentey 78ac2eaed7 [BitSet] Add remove(at:) implementation 2022-10-09 13:20:12 -07:00
Karoy Lorentey f71ebd9494 [PersistentDictionary] Implement structural merge operations
Merging is best done in-place, as merging a non-empty dictionary will
always mutate the dictionary, so we don’t have to tiptoe around
uniqueness issues.

(The union operation on PersistentSet is vaguely similar, but not
quite — unlike with merge, union is able directly link shared subtrees
into the result. However, a similar optimization may be worthwhile for
symmetricDifference.)
2022-09-30 19:55:04 -07:00
Karoy Lorentey a453335b26 [tests] Delay checking Indices until we’re done with the collection itself
Also, don’t check `DefaultIndices` — it’s fine to
assume it implements Collection as long as the base collection is
correct.
2022-09-23 11:15:46 -07:00
Karoy Lorentey b7bfc52664 [test] Add Dictionary API checker protocol
This can be used to verify that a new dictionary implementation
provides all expected members.
2022-09-19 21:25:07 -07:00
Karoy Lorentey d2e82ada53 [tests] checkBidirectionalCollection: Don’t pointlessly repeat index(_:offsetBy:limitedBy:) probe 2022-09-19 17:27:22 -07:00
Karoy Lorentey de31437ee5 Merge branch 'feature/PersistentCollections' into release/1.1 2022-09-19 16:02:51 -07:00
Karoy Lorentey 31eca4a02c Merge branch 'feature/BitSet' into release/1.1
# Conflicts:
#	Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme
2022-09-19 16:00:20 -07:00
Karoy Lorentey 52e3ea6ca9 [test] LifetimeTracked: Implement high-fidelity hash forwarding
`RawCollider` doesn’t like to get called through the high-level
hashing APIs.
2022-09-16 01:31:15 -07:00
Karoy Lorentey fcac09d86a [BitSet, BitArray] Add random factories 2022-08-25 22:21:34 -07:00
Karoy Lorentey 30da8ea7a1 [test] Enable index(_:offsetBy:limitedBy:) checks 2022-08-25 20:26:48 -07:00
Konrad `ktoso` Malawski 876586f924 expect type is correct 2022-08-17 11:06:07 +09:00
Karoy Lorentey 565c09e8d5 Review & update BitArray 2022-02-06 22:38:35 -08:00
Károly Lőrentey 13b5889757 [OrderedCollections][test] Strengthen withHiddenCopies tests
`withHiddenCopies(if:of:)` is supposed to check for value semantic violations where mutations of one copy affect another -- however, it currently only checks that iteration returns the same items before/after the change, not that the old copy is still in a fully consistent state.

Add an extra parameter that can be set to a closure that performs stricter checks.

Use it to call `_checkInvariants()` in ordered collections tests, uncovering a missing uniqueness check in `OrderedSet._insertNew(_:at:in:)`.
2021-11-11 00:39:29 -08:00
Karoy Lorentey f1f48d569a [test] CollectionsTestSupport → _CollectionsTestSupport
The underscored module name makes it clear that this isn't public API.
2021-09-03 15:57:09 -07:00