Commit Graph

1758 Commits

Author SHA1 Message Date
Dave Abrahams
c799f3687c [StdlibUnittest] Try to use ContiguousArray
ContiguousArray is a simpler component, thus less prone to breakage.
Builting the unit testing framework atop broken components is a very bad
idea, so let's not.

This is a reinstatement of an earlier commit, plus changes to make the
validation tests work.

Swift SVN r22867
2014-10-21 22:17:06 +00:00
Dmitri Hrybenko
fea8a8660a Add an array bridging race test that I forgot to add and commit some
time ago

Swift SVN r22751
2014-10-15 11:00:30 +00:00
Dave Abrahams
1fa082b7f6 Fix a RUN line missed in the test/[1_]stdlib reorg
Swift SVN r22749
2014-10-15 05:14:47 +00:00
Dave Abrahams
afa1ba6f51 Drop stdlib internal access for two tests
Swift SVN r22637
2014-10-09 21:50:27 +00:00
Dave Abrahams
3f36a4d5e7 Use %target-run-stdlib-swift in more tests
Now that it disables access control, this lit definition applies to many
more tests, where we used to use %target-run-stdlib-swift before access
control came online.

Also, drop -Xfrontend -disable-access-control from a bunch of tests that
don't need it.

Swift SVN r22634
2014-10-09 20:53:07 +00:00
Dmitri Hrybenko
d410ee7598 Move FixedPointDiagnostics to the validation testsuite
It is taking too long to run, rdar://18594315

Swift SVN r22619
2014-10-09 09:07:45 +00:00
Dmitri Hrybenko
4e4ebd856b MicroStdlib test: refactor RUN lines according to Jordan's review
Swift SVN r22565
2014-10-07 09:54:59 +00:00
Dmitri Hrybenko
50b2ca7370 Add a micro-stdlib to the validation testsuite
Swift SVN r22547
2014-10-06 19:20:39 +00:00
Dave Abrahams
156020de19 [stdlib] Rename 'countElements' => 'count'
The name was not only long and unwieldy, but inconsistent with our
conscious decision to avoid the use of "elements" in APIs as mostly
redundant.

Swift SVN r22408
2014-09-30 22:00:26 +00:00
Dmitri Hrybenko
252c2ffba7 stdlib: add a regression test for assert accepting a string literal
rdar://16987306

Swift SVN r22386
2014-09-30 14:39:21 +00:00
Dmitri Hrybenko
a04ee3a463 stdlib/Unicode: allow transcode() to operate on mutable value-typed
sinks

Swift SVN r22302
2014-09-26 17:28:00 +00:00
Dmitri Hrybenko
a3724588cb Fix and expand the AtomicInt test
The previous version of this test was disallowing some thread
interleavings that I did not consider.  See comments in the test for
more details.

Swift SVN r22300
2014-09-26 10:29:56 +00:00
Dave Abrahams
a9897a1aa1 [stdlib] Don't test internal APIs in validation
Swift SVN r22190
2014-09-22 22:24:07 +00:00
Doug Gregor
7764f64cf8 Simplify assertion machinery in the standard library.
This change includes a number of simplifications that allow us to
eliminate the type checker hack that specifically tries
AssertString. Doing so provides a 25% speedup in the
test/stdlib/ArrayNew.swift test (which is type-checker bound).

The specific simplifications here:
  - User-level
  assert/precondition/preconditionalFailure/assertionFailer/fatalError
  always take an autoclosure producing a String, eliminating the need
  for the StaticString/AssertString dance.
  - Standard-library internal _precondition/_sanityCheck/etc. always
  take a StaticString. When we want to improve the diagnostics in the
  standard library, we can provide a separate overload or
  differently-named function.
  - Remove AssertString, AssertStringType, StaticStringType, which are
  no longer used or needed
  - Remove the AssertString hack from the compiler
  - Remove the "BooleanType" overloads of these functions, because
  their usefuless left when we stopped making optional types conform
  to BooleanType (sorry, should have been a separate patch).



Swift SVN r22139
2014-09-19 17:56:50 +00:00
Doug Gregor
7f2757b5d0 Update validation suite to use initializers for literal conformances.
Swift SVN r22079
2014-09-18 16:48:47 +00:00
Dmitri Hrybenko
bda201fe95 Fix typo in the test name
Swift SVN r22068
2014-09-18 10:52:17 +00:00
Dmitri Hrybenko
2475a4ea57 stdlib: mark _stdlib_AtomicInt class 'final'
Swift SVN r22067
2014-09-18 09:31:52 +00:00
Dmitri Hrybenko
78331ff9fa Update HashingPrototype for stdlib API changes
Swift SVN r22021
2014-09-17 13:10:25 +00:00
Dmitri Hrybenko
ceff82f2ba stdlib/Array: add tests for Array -> NSArray bridging
Swift SVN r21939
2014-09-15 13:49:50 +00:00
Dmitri Hrybenko
d7acb06c64 stdlib/Dictionary: use 'delayed bridging' to keep pointers, returned
from a bridged NSDictionary, stable

We used to return a fresh pointer value every time an NSDictionary
element is requested, but, unfortunately, our SDK has bugs.

Fixes rdar://18191358 for Dictionary.

Swift SVN r21905
2014-09-12 13:20:30 +00:00
Dmitri Hrybenko
37562576af Update AtomicInt test for removal of any()
Swift SVN r21903
2014-09-12 09:24:34 +00:00
Joe Groff
6f64c4ce12 Update validation tests for raw -> rawValue change.
Swift SVN r21893
2014-09-11 22:27:01 +00:00
Dmitri Hrybenko
d68a5c4c98 stdlib: finish implementation of atomics for initializing an ARC
reference, add tests

Swift SVN r21873
2014-09-11 14:52:58 +00:00
Dmitri Hrybenko
96d00d70b5 StdlibUnittest: add infrastructure for race tests (see examples)
This will be used to test rdar://18191358

Swift SVN r21836
2014-09-10 11:58:45 +00:00
Joe Groff
419ba5cbea Change RawRepresentable to use failable initializers and property requirements.
Redefine the RawRepresentable protocol to use an 'init?' method instead of 'fromRaw(Raw)', and a 'raw' get-only property instead of 'toRaw()'. Update the compiler to support deriving conformances for enums and option sets with the new protocol. rdar://problem/18216832

Swift SVN r21762
2014-09-06 18:40:14 +00:00
Dmitri Hrybenko
b6308cae7c Update UnicodeUTFEncoders for failable initializers
Swift SVN r21701
2014-09-04 11:11:12 +00:00
Dmitri Hrybenko
8f2c13fa94 Add a prototype of new hashing APIs (so that it does not bit rot on my disk)
Unfortunately, I don't see how to ensure interoperability with Objective-C.


Swift SVN r21581
2014-08-29 16:57:45 +00:00
Dmitri Hrybenko
60cf5d3d1b SwiftIntTypes.py: remove transitional '_new' suffix from a function name
Swift SVN r21579
2014-08-29 15:38:22 +00:00
Dmitri Hrybenko
717171b89d stdlib tests: use simpler interface to iterate over integer types
Swift SVN r21577
2014-08-29 15:14:35 +00:00
Dmitri Hrybenko
2b6ccd2deb Add tests for traps in shift operations
Swift SVN r21575
2014-08-29 15:10:03 +00:00
Dmitri Hrybenko
cb9e5c2c86 stdlib: use simpler interface to iterate over integer types
Swift SVN r21573
2014-08-29 14:32:46 +00:00
Dmitri Hrybenko
c5181c2d65 stdlib/FixedPoint: fix hash computation for [U]Int64 on 32-bit platforms
It used to trap if the value of [U]Int64 was outside the Int32 range.

rdar://18113807

Swift SVN r21572
2014-08-29 13:48:32 +00:00
Dmitri Hrybenko
1bc40d22ef FixedPoint test: use correct argument order for expectEquals
Swift SVN r21571
2014-08-29 13:37:19 +00:00
Dmitri Hrybenko
14899abdf5 stdlib/FixedPoint: define the same set of 'truncatingBitPattern'
initializers on all platforms

rdar://18167806

Swift SVN r21570
2014-08-29 10:32:33 +00:00
Dmitri Hrybenko
be9850d8de stdlib: add a test for passing literals to the IntXX(bitPattern:) initializer
Swift SVN r21482
2014-08-27 10:11:58 +00:00
Dmitri Hrybenko
61ef07732f stdlib/FixedPoint: add IntXX(truncatingBitPattern:) initializers
rdar://18101336


Swift SVN r21481
2014-08-27 10:04:33 +00:00
Dmitri Hrybenko
f1c3d879ef StdlibUnittest: add setUp and tearDown functions, which are executed before and
after every test


Swift SVN r21362
2014-08-21 16:56:49 +00:00
Dmitri Hrybenko
4a9245fbe4 Move Assert.swift test to the validation testsuite
Swift SVN r21269
2014-08-18 23:05:21 +00:00
Dmitri Hrybenko
9ae778a286 Remove long_tests requirement from tests in the validation testsuite
Swift SVN r21268
2014-08-18 23:03:50 +00:00
Dmitri Hrybenko
9276660e8a Move long-running Unicode tests to the validation testsuite
Swift SVN r21267
2014-08-18 23:03:47 +00:00
Dmitri Hrybenko
b689a27300 Move FixedPointArithmeticTraps test to the validation test suite
Swift SVN r21266
2014-08-18 22:56:01 +00:00
Dmitri Hrybenko
8cca039e62 StdlibUnittest: rename TestCase to TestSuite since it contains multiple tests
Thanks, Ben!


Swift SVN r21222
2014-08-15 00:09:58 +00:00
Dmitri Hrybenko
cfa2bdaf83 stdlib/Hashing: use unchecked arithmetic when mixing in the per-execution seed
The per-process seed is actually fixed right now, so this bug was dormant.


Swift SVN r21189
2014-08-14 00:25:44 +00:00
Dmitri Hrybenko
94f5917b6d Fix hashing test for 32-bit:
* update stale values for hashes (the previous one were from one of my
  earlier hash implementations)

* add a separate code path for 32-bit where Int type is used

Swift SVN r21147
2014-08-12 16:11:34 +00:00
Dmitri Hrybenko
3a04e0809f stdlib: add a function to squeeze a number in a given range from a hash value
This function mixes the bits in the hash value, which improves Dictionary
performance for keys with bad hashes.

PrecommitBenchmark changes with greater than 7% difference:

``````````Dictionary2`,```1456.00`,```1508.00`,```1502.00`,````624.00`,````607.00`,````592.00`,`864.00`,``145.9%
``````````Dictionary3`,```1379.00`,```1439.00`,```1408.00`,````585.00`,````567.00`,````552.00`,`827.00`,``149.8%
````````````Histogram`,````850.00`,````849.00`,````851.00`,```1053.00`,```1049.00`,```1048.00`,`199.00`,``-19.0%
````````````````Prims`,```1999.00`,```2005.00`,```2018.00`,```1734.00`,```1689.00`,```1701.00`,`310.00`,```18.4%
``````````StrSplitter`,```2365.00`,```2334.00`,```2316.00`,```1979.00`,```1997.00`,```2000.00`,`337.00`,```17.0%
```````````````TwoSum`,```1551.00`,```1568.00`,```1556.00`,```1771.00`,```1741.00`,```1716.00`,`165.00`,```-9.6%

Regressions are in benchmarks that use `Int` as dictionary key: we are just
doing more work than previously (hashing an `Int` was an identity function).

rdar://17962402


Swift SVN r21142
2014-08-12 12:02:26 +00:00
Dmitri Hrybenko
8ab9066061 Relax FileCheck patterns because stdout and stderr are sometimes mixed
Swift SVN r21130
2014-08-10 17:18:05 +00:00
Dmitri Hrybenko
2e044243df Relax the FileCheck pattern to allow the test to pass on iOS
Swift SVN r21129
2014-08-09 19:28:26 +00:00
Dmitri Hrybenko
4b9c318c05 stdlib: correct trap messages for float to integer conversion
rdar://17943841


Swift SVN r21128
2014-08-09 18:02:28 +00:00
Dmitri Hrybenko
a5c03a5e13 stdlib: trap when constructing integers from Float and Double NaNs. Not implementable for Float80 yet.
Partially fixes rdar://17958458


Swift SVN r21109
2014-08-08 15:43:39 +00:00
Dmitri Hrybenko
7255f900b9 stdlib: move test for floating point conversion traps to the validation
testsuite

Fixes for traps will follow.


Swift SVN r21108
2014-08-08 15:20:05 +00:00