Commit Graph

51 Commits

Author SHA1 Message Date
Arnold Schwaighofer
e113ef8c93 Add a mode to test implicit dynamic with private imports 2019-03-20 14:34:01 -07:00
Pavol Vaskovic
ac04995089 [Gardening] Remove DoubleWidth dead code from test 2019-03-01 20:51:43 +01:00
Karoy Lorentey
666a22feff [test] Modernize hashing throughout the test suite 2018-11-29 17:38:29 +00:00
Doug Gregor
0a8058ca6a [Integer protocols] Make BinaryInteger.Words conform to RandomAccessCollection.
Require that BinaryInteger.Words conform to RandomAccessCollection with
an Index type of Int, simplifying clients.

Fixes rdar://problem/36410936.
2018-09-05 16:22:27 -07:00
Stephen Canon
190c7d6b9f Default implementation of isMultiple(of:) on BinaryInteger
In order to provide source compatibility with existing user types conforming to BinaryInteger, we want to have a default implementation available. It's somewhat difficult to provide a good default implementation that correctly handles arbitrary non-symmetrical ranges in the face of negative divisors, so fall back on testing divisibility of the magnitudes, which avoids the problem.

On the plus side, this default implementation works fine for types conforming to UnsignedInteger, which lets us move the FixedWidthInteger implementation down to FixedWidthInteger & SignedInteger, and simplify it in the process.
2018-09-04 16:32:14 -04:00
Stephen Canon
c1f25e0673 [SE-0225] Implementation of isMultiple for BinaryInteger. (#18689)
* Implement SE-0225 (BinaryInteger.isMultiple(of:))

A default implementation is provided for FixedWidthInteger, with very basic test coverage included.
2018-09-04 10:31:05 -04:00
Stephen Canon
35db40c9f9 Make BinaryInteger._binaryLogarithm() return Int instead of Self (#18219)
Returning `Self` was probably a hack from when shifts were required to be homogenous and we didn't have good generic inits between integer types. Returning Int is more natural, because:

1. Dimensional analysis says that we shouldn't expect the logarithm to have the same type.
2. Int is guaranteed to be able to represent any object size, and BinaryInteger does not admit sparse representations, so the logarithm of the value cannot exceed allocated storage size.
3. Every single use case in the stdlib and tests is either unchanged or simplified by this change.
2018-07-25 14:04:32 -04:00
Max Moiseev
141fefc06b Update tests after removal of DoubleWidth 2018-03-23 17:14:46 -07:00
bruno-rocha-movile
08610df3e7 [stdlib] Improve masked operator tests 2018-03-19 18:45:09 -03:00
bruno-rocha-movile
16d793afbd [stdlib] Add overflow operator tests 2018-03-19 17:46:21 -03:00
Saleem Abdulrasool
b67d5f0cf7 test: convert rm -rf && mkdir -p into %empty-directory
This converts the instances of the pattern for which we have a proper
substitution in lit.  This will make it easier to replace it
appropriately with Windows equivalents.
2018-03-06 14:30:54 -08:00
Xiaodi Wu
cc0e64dec4 Implement efficient DoubleWidth division and fix division-related bugs 2018-01-28 14:01:06 -06:00
Xiaodi Wu
7e03829aab Improve _binaryLogarithm implementation and add tests 2018-01-18 16:45:41 -06:00
Paul Menage
428d95b32c Fix typo in 32-bit portion of Integers test 2017-11-29 17:25:37 -08:00
Nate Cook
5dbfa2d947 Update tests for larger integer sizes 2017-11-24 23:06:12 -06:00
Nate Cook
1acb38aa9e [stdlib] Add more tests for strideable behavior 2017-09-29 22:57:46 -05:00
Nate Cook
4e45358a49 Merge branch 'master' into nc-dwformatting 2017-08-02 14:54:56 -05:00
Maxim Moiseev
52259b714b Merge pull request #11193 from xwu/lossless-integers
[stdlib] Conform fixed-width integer types to LosslessStringConvertible
2017-07-28 20:10:07 -07:00
Xiaodi Wu
7578822e27 Another minor fixup for type inference in expectEqualSequence 2017-07-27 18:55:41 -05:00
Xiaodi Wu
f99f03c157 Minor fixup for type inference in expectEqualSequence 2017-07-27 18:53:10 -05:00
Xiaodi Wu
14a7c78454 Update integer parsing test to use expectEqualSequence 2017-07-27 18:49:22 -05:00
Xiaodi Wu
add2bce944 Revise doc comments and add test 2017-07-26 22:57:28 -05:00
Max Moiseev
1c3e597928 [stdlib] Get rid of ArithmeticOverflow type 2017-07-26 11:09:36 -07:00
Maxim Moiseev
a5ff35cd41 [stdlib] extendingOrTruncating: => truncatingIfNeeded: 2017-07-26 11:09:36 -07:00
Nate Cook
e3e36f75a8 [test] Increase DoubleWidth bit shifting test coverage 2017-07-24 19:35:59 -05:00
Károly Lőrentey
735fe97242 [stdlib] Fix sign extension in word -> multi-word integer conversions
This fixes integer conversion issues on 32-bit platforms.
2017-07-11 04:33:14 +02:00
Károly Lőrentey
6ae2040c42 [stdlib][test] Update integer tests. 2017-07-10 22:40:52 +02:00
Nate Cook
1149eeac16 Incorporate feedback from @moiseev
- Also clean up some 80-column issues
- And improve some tests from before literal expressibility
2017-05-25 18:32:15 -05:00
Nate Cook
5ab34bf6f0 Add floating-point initializers and tests 2017-05-24 19:16:26 -05:00
Nate Cook
40f6869b80 More tests for DoubleWidth 2017-05-24 19:16:26 -05:00
Nate Cook
4a24a968ca Slightly better DoubleWidth testing 2017-05-24 19:16:26 -05:00
Nate Cook
c8f4c4bb8e A few tests for DoubleWidth 2017-05-24 19:16:26 -05:00
Max Moiseev
0a466e3ca0 Revert "[stdlib] Implementing copy constructors for integer types"
This reverts commit 3f0d1e61aa.

The copy constructors don't really solve any problems, but produce extra
work for the overload resolution.
2017-05-13 12:27:43 -07:00
Max Moiseev
3f0d1e61aa [stdlib] Implementing copy constructors for integer types 2017-05-12 17:37:04 -07:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
Maxim Moiseev
e868ca7035 [stdlib] Better BinaryInteger.signum and tests 2017-05-11 14:02:59 -07:00
Maxim Moiseev
13abb9a0a7 [stdlib] BinaryInteger func word(at:) => var words: Words (#8984)
* [stdlib] Underscoring BinaryInteger.word(at:)

* [stdlib] Implementing var words in terms of _word(at:)
2017-04-25 08:45:01 -07:00
swift-ci
20dcfcb425 Merge pull request #8860 from moiseev/unsigned-minus-one 2017-04-19 11:50:53 -07:00
Max Moiseev
830b2edf54 [stdlib] Check overflow in integer init from literal
Fixes: <rdar://problem/29911715>
And partially: <rdar://problem/29937936>
2017-04-19 11:06:26 -07:00
practicalswift
a029589093 [gardening] Use consistent headers 2017-04-18 19:51:08 +02:00
Max Moiseev
2e67c13d15 Fixing some tests 2017-04-14 16:19:06 -07:00
Max Moiseev
f106bd9529 Running new integer tests in Swift 4 mode only 2017-04-12 17:03:46 -07:00
Max Moiseev
233fb21dd6 multipliedFullWidth(by:) and dividingFullWidth(_:) 2017-03-13 15:16:58 -07:00
Max Moiseev
ff81681f4f Properly naming bit count properties 2017-03-13 11:50:02 -07:00
Max Moiseev
494acaacf9 Fixing the trailingZeroBits test 2017-01-30 17:25:56 -08:00
Max Moiseev
c342166f10 Renaming leadingZeros to leadingZeroBits. Same for trailingZeros 2017-01-30 17:16:16 -08:00
Max Moiseev
1814e4fce3 Fixing tests 2017-01-23 10:59:31 -08:00
Max Moiseev
d71c73bbba Fixing stdlib tests 2017-01-06 18:08:36 -08:00
Max Moiseev
ea8f2209a3 Overflow checks in division/modulo operators + tests 2016-12-15 16:32:07 -08:00
Max Moiseev
94564ebc37 Adding some doubleWidthMultiply and bouldWidthDivide tests 2016-12-15 13:42:47 -08:00