Commit Graph

1234 Commits

Author SHA1 Message Date
David Farler
598cf7e282 Add test for SequenceType.split for the separator overload
Swift SVN r30510
2015-07-22 22:51:26 +00:00
Dmitri Hrybenko
bbed5aae68 StdlibUnittest: fix the definition of a 'slice type'
Swift SVN r30508
2015-07-22 22:13:25 +00:00
David Farler
1f2390f1c7 Drop APIs from NSPathUtilities.h on String
rdar://problem/18848175

Swift SVN r30507
2015-07-22 22:12:56 +00:00
David Farler
5eb9f396d6 Default removeFirst for Slice, ArraySlice
Add a default implementation for CollectionTypes where their SubSequence
== Self. That is, mainly, Slice and ArraySlice. This changes the slice's
view of, but not modifying or copying, the underlying collection.

rdar://problem/20302034

Swift SVN r30496
2015-07-22 08:07:37 +00:00
Dmitri Hrybenko
0525573de7 stdlib: use syntax sugar for Array
Swift SVN r30489
2015-07-22 04:16:22 +00:00
Dave Abrahams
417788892f [stdlibunittest] Suppress a warning
Swift SVN r30459
2015-07-21 21:22:23 +00:00
David Farler
ada08bdf2b SequenceType.split enhancements
- De-underscore the API that takes an equatable separator, add doc
  comment, and add a test for it.
- Add a test for the negative maxSplit case.
- Add lifetime tracker for isSeparator closure in the semantic test.

Swift SVN r30413
2015-07-20 21:34:19 +00:00
Dmitri Hrybenko
364176d007 stdlib: make crash tests more strict
Swift SVN r30397
2015-07-20 15:39:14 +00:00
Dmitri Hrybenko
08a84ca5a1 stdlib tests: simplify map() calls with currying
Swift SVN r30379
2015-07-19 01:49:10 +00:00
Dmitri Hrybenko
7fbfe24081 stdlib: Sequence tests: prefix test name with the type name
Swift SVN r30378
2015-07-19 01:22:11 +00:00
Dmitri Hrybenko
3ef09f3352 stdlib: make trap tests more strict
Swift SVN r30377
2015-07-19 01:22:10 +00:00
Dmitri Hrybenko
420337a5bf stdlib: move forEach() test to the SequenceType testsuite
Swift SVN r30376
2015-07-19 01:22:08 +00:00
David Farler
0d1b03086d Add slicing extensions to SequenceType and CollectionType.
rdar://problem/21663830

Add the following new requirements to SequenceType with default implementations:

- dropFirst(n)
- dropLast(n)
- prefix(n)
- suffix(n)
- split(n)

In addition, provide specialized default implementations of these for CollectionTypes with forward, bidirectional, and random-access Index types where possible.

Add the following new requirements to CollectionType with default implementations:

- prefixThrough(n)
- prefixUpTo(n)
- suffixFrom(n)
- split() // isSeparator closure

Add the following convenience APIs:

- dropFirst() -> calls dropFirst(1)
- dropLast() -> calls dropLast(1)

Add a tentative underscored API:

- split() // takes Equatable separator.

Some APIs have undefined behavior when creating slices where the endpoints go beyond the bounds of the underlying collection. This will be fixed later by trapping creation of slices with invalid indices (rdar://problem/21822657).

Swift SVN r30371
2015-07-18 06:51:22 +00:00
Dave Abrahams
e3bcd90d70 [stdlibunittest] Warning suppression
Swift SVN r30360
2015-07-18 02:58:35 +00:00
Joe Groff
6608221a72 stdlib: Remove _UnitTestArray.
rdar://problem/20246497

Swift SVN r30348
2015-07-18 00:14:28 +00:00
Jordan Rose
aac0342e48 [stdlib] More type annotations to reduce compile time.
The big one, though, is the use of 'lazy' in _masterThreadOneTrial.
Removing it takes the function from 62s to 2s on my machine.
That's rdar://problem/20875936.

Swift SVN r30292
2015-07-17 00:22:03 +00:00
Dmitri Hrybenko
e5e4335fad stdlib: Slice: trap on out-of-bounds indices
rdar://21822657

Swift SVN r30269
2015-07-16 18:22:40 +00:00
David Farler
6099e156eb Add RangeReplaceableCollectionType.removeFirst
Add requirements and default implementations for removeFirst() and
removeFirst(n: Int).

rdar://problem/21844880

Swift SVN r30256
2015-07-16 07:47:06 +00:00
David Farler
86f1a7088b Review: Rename SequenceType.forEach parameter to 'body'
No functional change.

Swift SVN r30249
2015-07-16 04:07:17 +00:00
David Farler
91b89b8956 Add SequenceType.forEach requirement and default implementation
rdar://problem/21663830

Swift SVN r30236
2015-07-15 23:36:23 +00:00
Dave Abrahams
34bc4068d6 [stdlibunittest] Suppress some pesky warnings
Swift SVN r30212
2015-07-15 05:45:46 +00:00
Joe Groff
f739f85137 StdlibUnittest: Keep qualified type names in failure output.
The unambiguous qualification is likely desirable to someone figuring out why their tests failed.

Swift SVN r30170
2015-07-13 22:31:37 +00:00
Dave Abrahams
7221cd84df [stdlibunittest] Add expectations to TypeIndexed
Swift SVN r30138
2015-07-13 06:40:44 +00:00
Dmitri Hrybenko
4cfe818c43 StdlibUnittest: extract collection tests into a reusable generic testsuite
Swift SVN r30124
2015-07-12 01:04:38 +00:00
Dmitri Hrybenko
1d38db56da StdlibUnittest: add {Minimal|Default}***MutableCollection types
Swift SVN r30115
2015-07-11 08:48:38 +00:00
Dave Abrahams
069ba3ecf6 [stdlibunittest] Gyb-away code duplication in logging wrappers
Swift SVN r30110
2015-07-11 04:02:11 +00:00
Dave Abrahams
645e62769f [stdlibunittest] LoggingCollection should log *all* SequenceType operations.
Swift SVN r30108
2015-07-11 03:25:40 +00:00
Dave Abrahams
9d07acd368 [stdlib] SequenceType's _initializeTo should return the end position
Otherwise, the length of the sequence is in principle lost.  If you know
you have a sequence of less than 100 elements, you still want to know
exactly how many elements you initialized from it.

Swift SVN r30104
2015-07-11 01:43:27 +00:00
Dave Abrahams
6ab88e2ade [stdlibunittest] Add/use checkRandomAccessIndex
Swift SVN r30077
2015-07-10 18:51:19 +00:00
Dave Abrahams
c1f371a5b8 [stdlibunittest] Add checkStrideable
Also, apply it, in a rudimentary way, to our floating point types.

Swift SVN r30068
2015-07-10 14:27:11 +00:00
Dave Abrahams
c2b3005dba [stdlibunittest] Add/use checkComparable that tests laws
Swift SVN r30042
2015-07-09 21:40:58 +00:00
Dave Abrahams
7a614f76fc [stdlibunittest] Add/Use checkBidirectionalIndex
Swift SVN r30022
2015-07-09 17:10:27 +00:00
Dave Abrahams
76ec395dae [stdlibunittest] WIP Adding axiom checking
Check that the expected laws hold for models of Equatable, Hashable,
Incrementable, and ForwardIndexType.

Swift SVN r29988
2015-07-08 20:04:37 +00:00
Dave Abrahams
ef198daa2b [stdlibunittest] Finish threading new trace facility through
Swift SVN r29955
2015-07-08 02:52:27 +00:00
Jordan Rose
1edf9b3ae8 Check access for associated type requirements, too.
This is a straight-up "oops". You could always get to these typealiases via
the protocol, but like the member requirements you should have to say so.

Swift SVN r29952
2015-07-08 00:43:37 +00:00
Dave Abrahams
ce93b0a9e0 [stdlibunittest] Still more de-boilerplating WIP
Swift SVN r29951
2015-07-08 00:28:33 +00:00
Dave Abrahams
70ee2adc84 [stdlibunittest] More de-boilerplating WIP
Step 2.

Swift SVN r29936
2015-07-07 04:54:03 +00:00
Dave Abrahams
9abf32d521 [stdlibunittest] WIP uniformity/de-boilerplating
The way we pass and compose source locations, messages, etc. needs to be
brought under control before too many more tests get written.  This is
the first step.

Swift SVN r29928
2015-07-07 00:46:54 +00:00
David Farler
4d17bf0691 Remove SinkType and SinkOf
Remove these standard library types in favor of (T) -> () closures.

It was originally believed that generic optimizations would make these
types profitable, however:

// FIXME: Insert benchmarks here.

rdar://problem/21663799

Swift SVN r29927
2015-07-07 00:36:12 +00:00
Dmitri Hrybenko
4603431bd4 StdlibUnittest: implement more strict checks for using invalid indices
Add a shared buffer to every range replaceable mutable collection to
track logical mutations, and invalidate all indices on every mutation.

Swift SVN r29917
2015-07-06 16:12:03 +00:00
David Farler
402bbd3813 RangeReplaceableCollectionType review changes
- Clean up tests
  - Create API-specific test structures with clearer labels
  - Use `OpaqueValue`s in test collections
  - Make tests non-generic to allow array literal declarations
  - Remove some unused functions
  - Test return values for mutating functions that return a value
  - Add expect* test source locations
- Add _customRemoveLast ad-hoc default implementation for `removeLast`
- Add default implementation for reserveCapacity that does nothing.

Swift SVN r29905
2015-07-03 02:14:22 +00:00
Dmitri Hrybenko
1edcc49ff9 stdlib: remove Slice.Element typealias
It is misleading in generic code.  A testcase that was failing:

  expectEqualType(C.Generator.Element.self, Slice<C>.Element.self)

Swift SVN r29887
2015-07-02 06:44:38 +00:00
David Farler
060b1ab61b Remove redundant MinimalCollection for RangeReplaceable tests
There are usable variants gybbed into StdlibUnittest.

Swift SVN r29864
2015-07-01 23:44:15 +00:00
David Farler
438119d558 Fold ExtensibleCollectionType into RangeRaplaceableCollectionType
ExtensibleCollectionType's operations can all be represented by the
primitive range replacement operation, so fold it into
RangeReplaceableCollectionType.

In addition, provide default implementations of
RangeReplaceableCollectionType's methods.

- New tests added for combinations of (static, generic) calls and
  (default, custom) implementations.
- Mark free Swift functions as unavailable with a message to direct the
  developer to the protocol methods.
- Mark ExtensibleCollectionType as available with a message added to
  direct the developer to the right protocol.

rdar://problem/18220295

Swift SVN r29857
2015-07-01 22:33:04 +00:00
Dmitri Hrybenko
fc0fa96371 stdlib: de-underscore Indexable and add tests for it
Swift SVN r29847
2015-07-01 18:31:31 +00:00
Dmitri Hrybenko
76f5706b50 stdlib: de-underscore the Slice type and add tests for it
Swift SVN r29846
2015-07-01 18:31:29 +00:00
Dmitri Hrybenko
80b1380fe8 stdlib: fold Sliceable into CollectionType and de-underscore SubSequence
Swift SVN r29845
2015-07-01 18:31:25 +00:00
Dave Abrahams
10d7c3db50 [stdlibunittest] Use a legitimate TypeIdentifier
...instead of ObjectIdentifier, to wrap Any.Type, and add protocol
conformances.  ObjectIdentifier doesn't print nicely, because there's
really no type information left, and TypeIdentifier makes for better
output when tests fail.

Swift SVN r29813
2015-06-30 22:36:41 +00:00
Dave Abrahams
4bc3815135 [stdlibunittest] Missed update to CMakeLists.txt
Swift SVN r29791
2015-06-29 20:47:10 +00:00
Dave Abrahams
8c855e1ecf [stdlibunittest] automatic LifetimeTracked checking/setup
In setup and teardown, we can initialize and check for leaks

Swift SVN r29789
2015-06-29 20:45:50 +00:00