summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/algorithms
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix PR#35119 : set_union misbehaves with move_iterators. Thanks to Denis ↵Marshall Clow2017-10-301-0/+44
| | | | | | Yaroshevskiy for both the bug report and the fix. llvm-svn: 316914
* Fix test for C++03Marshall Clow2017-08-291-3/+4
| | | | llvm-svn: 311967
* Fix PR31166: std::inplace_merge seems to be unstable. Thanks to Jan Wilken ↵Marshall Clow2017-08-281-0/+21
| | | | | | Dörrie for the suggested fix. llvm-svn: 311952
* [libcxx] [test] Change comments to say C++ instead of c++. NFC.Stephan T. Lavavej2017-07-292-2/+2
| | | | | | | | This makes them consistent (many comments already used uppercase). The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change. llvm-svn: 309468
* [libcxx] [test] Untabify, NFC.Stephan T. Lavavej2017-07-297-47/+47
| | | | llvm-svn: 309464
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2017-06-201-5/+5
| | | | llvm-svn: 305848
* Add non-parallel version of for_each_n (+tests) from the Parallelism TSMarshall Clow2017-05-251-0/+61
| | | | llvm-svn: 303833
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2017-05-044-4/+4
| | | | llvm-svn: 302105
* Cleanup _LIBCPP_HAS_NO_<c++11-feature> in algorithmEric Fiselier2017-04-1815-101/+63
| | | | llvm-svn: 300625
* Update the algorithm tests to not use the (deprecated) function binders. No ↵Marshall Clow2017-03-237-14/+42
| | | | | | functional change. llvm-svn: 298618
* Use 'REQUIRES: c++98 || c++03 || c++11 || c++14' instead of the deprecated ↵Marshall Clow2017-03-232-2/+2
| | | | | | 'REQUIRES-ANY: c++98, c++03, c++11, c++14' llvm-svn: 298600
* Remove random_shuffle in C++17. Please use shuffle instead. If you have to, ↵Marshall Clow2017-03-232-0/+2
| | | | | | you cant get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE before including any libc++ headers. llvm-svn: 298597
* Stop using random_shuffle in the libc++ test suite. It's going to be removed ↵Marshall Clow2017-02-0727-35/+116
| | | | | | in c++17. Use shuffle() instead. No change to libc++, just the tests. llvm-svn: 294328
* Enable the -Wsign-compare warning to better support MSVCEric Fiselier2016-12-1117-97/+102
| | | | llvm-svn: 289363
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-083-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | loss of data", part 6/7. test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp (Affects 64-bit architectures.) Include <cstddef> so we can take/return std::ptrdiff_t (instead of int) in random_shuffle()'s RNG. (C++14 D.12 [depr.alg.random.shuffle]/2 says that difference_type is used, and we're shuffling a plain array.) test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp (Affects 64-bit architectures.) Include <iterator> because we're already using iterator_traits. Then, store the result of subtracting two RanIts as difference_type instead of long (which truncates on LLP64 architectures like MSVC x64). test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp (Affects 64-bit architectures.) Include <cstddef> so we can store the result of subtracting two pointers as std::ptrdiff_t (instead of int). test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp (Affects 32-bit architectures.) Sometimes, size_t is too small. That's the case here, where tellg() returns pos_type (N4606 27.7.2.3 [istream.unformatted]/39). Implementations can have 64-bit pos_type (to handle large files) even when they have 32-bit size_t. Fixes D27543. llvm-svn: 289110
* [libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-062-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | part 12/12. Various changes: test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp This is comparing value_type to unsigned. value_type is sometimes int and sometimes struct S (implicitly constructible from int). static_cast<value_type>(unsigned) silences the warning and doesn't do anything bad (as the values in question are small). test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp This is comparing an int remote-element to size_t. The values in question are small and non-negative, so either type is fine. I think that converting int to size_t is marginally better here than the reverse. test/std/containers/sequences/deque/deque.cons/size.pass.cpp DefaultOnly::count is int (and non-negative). When comparing to unsigned, use static_cast<unsigned>. test/std/strings/basic.string/string.access/index.pass.cpp We're comparing char to '0' through '9', but formed with the type size_t. Add static_cast<char>. test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp Include <cstddef> for pedantic correctness (this test was already mentioning std::size_t). "v[i] == (i & 1)" was comparing bool to size_t. Saying "v[i] == ((i & 1) != 0)" smashes the RHS to bool. llvm-svn: 288749
* [libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-065-7/+7
| | | | | | | | | | | | part 10/12. Add static_cast<int>. In these cases, the values are guaranteed to be small-ish, and they're being compared to int elements. test/std/containers/sequences/deque/deque.capacity/access.pass.cpp Use int instead of unsigned to iterate from 0 to 10. llvm-svn: 288747
* [libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-061-3/+4
| | | | | | | | | | part 9/12. Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.) Also, include <cstddef> when it wasn't already being included. llvm-svn: 288746
* Work around more -Wshadow warningsEric Fiselier2016-12-031-1/+1
| | | | llvm-svn: 288573
* [libcxx] [test] D27027: Strip trailing whitespace.Stephan T. Lavavej2016-11-232-4/+4
| | | | llvm-svn: 287829
* [libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-231-1/+1
| | | | | | | | | | | | | | | | | | | part 5/12. Various changes: test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp Change M from unsigned to int. It's compared against "int x", and we binary_search() for it within a vector<int>. test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp Add static_cast<unsigned> when comparing int to unsigned. test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp Change unsigned indices to int when we're being given int as a bound. llvm-svn: 287825
* [libcxx] [test] D27015: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-2321-29/+29
| | | | | | | | part 3/12. Change unsigned to int in parameters. llvm-svn: 287823
* [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-234-6/+10
| | | | | | | | | | part 2/12. Add static_cast<std::size_t> when comparing int to std::size_t. Also, include <cstddef> when it wasn't already being included. llvm-svn: 287822
* [libcxx] [test] D27013: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-238-8/+16
| | | | | | | | | | part 1/12. Change loop indices from int to std::size_t. Also, include <cstddef> when it wasn't already being included. llvm-svn: 287820
* [libcxx] [test] D26816: Fix non-Standard assumptions when testing sample().Stephan T. Lavavej2016-11-181-3/+14
| | | | | | | | | | | | | sample() isn't specified with a reproducible algorithm, so expecting exact output is non-Standard. Mark those tests with LIBCPP_ASSERT. In test_small_population(), we're guaranteed to get all of the elements, but not necessarily in their original order. When PopulationCategory is forward, we're guaranteed stability (and can therefore test equal()). Otherwise, we can only test is_permutation(). (As it happens, both libcxx and MSVC's STL provide stability in this scenario for input-only iterators.) llvm-svn: 287383
* Add missing include in test; NFC. Thanks to Jonathan Wakely for the report.Marshall Clow2016-10-131-0/+1
| | | | llvm-svn: 284120
* Purge all usages of _LIBCPP_STD_VER under test/std/algorithmEric Fiselier2016-10-0817-121/+132
| | | | llvm-svn: 283643
* Implement C++17 std::sample.Eric Fiselier2016-08-283-0/+244
| | | | | | | | This patch implements the std::sample function added to C++17 from LFTS. It also removes the std::experimental::sample implementation which now forwards to std::sample. llvm-svn: 279948
* Mark LWG 2716 as complete - shuffle and sample disallows lvalue URNGs.Eric Fiselier2016-08-281-1/+1
| | | | | | | | | | | Libc++'s implementation of shuffle and sample already support lvalue and rvalue RNG's. This patch adds tests for both categories and marks the issue as complete. This patch also contains drive-by change for std::experimental::sample which improves the diagnostics produced when the correct iterator categories are not supplied. llvm-svn: 279947
* Fix portability issues in <random> tests. Patch from STL@microsoft.comEric Fiselier2016-07-243-5/+16
| | | | llvm-svn: 276585
* Implement LWG#2688: 'clamp misses preconditions and has extraneous condition ↵Marshall Clow2016-06-302-4/+135
| | | | | | on result'. We already did this, just added tests llvm-svn: 274252
* Add array bounds assertions to satisfy MSVC's /analyze flag. Patch from ↵Eric Fiselier2016-06-262-0/+8
| | | | | | STL@microsoft.com llvm-svn: 273820
* Move remaining _LIBCPP_VERSION tests into test/libcxxEric Fiselier2016-06-221-20/+0
| | | | llvm-svn: 273367
* Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier2016-06-146-12/+12
| | | | | | | | | TEST_STD_VER. This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! llvm-svn: 272716
* [libcxx] Fix c++98 test failures.Asiri Rathnayake2016-06-032-2/+2
| | | | | | | | | Adds XFAIL/UNSUPPORTED lit tags as appropriate. Gets a clean test run for -std=c++98 on Fedora 20. NFC. llvm-svn: 271741
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-0113-20/+20
| | | | llvm-svn: 271435
* Remove names of unreferenced parameters. Patch from STL@microsoft.comEric Fiselier2016-04-281-1/+1
| | | | llvm-svn: 267852
* Add braces, move braces, and rename variables to avoid shadowing. Patch from ↵Eric Fiselier2016-04-281-0/+2
| | | | | | STL@microsoft.com llvm-svn: 267844
* Implement P0025R0: 'An algorithm to clamp a value between a pair of boundary ↵Marshall Clow2016-03-072-0/+121
| | | | | | values' for C++17 llvm-svn: 262871
* Change some #ifdefs to #if - thanks to Dexon for thge catch.Marshall Clow2015-07-302-4/+4
| | | | llvm-svn: 243641
* Fix a self-move bug in inplace_merge. Thanks to Ted and Dexon for the report ↵Marshall Clow2015-07-292-10/+69
| | | | | | and the suggested fix. llvm-svn: 243530
* Fix warnings in test/std/algorithmsEric Fiselier2015-07-185-16/+15
| | | | llvm-svn: 242626
* Fix for LWG Issue 2369: constexpr max(initializer_list) vs max_elementMarshall Clow2015-05-106-0/+89
| | | | llvm-svn: 236952
* Need to wrap a bit in an ifdef, since there are no initializer_lists in C++03Marshall Clow2015-02-111-0/+2
| | | | llvm-svn: 228840
* Fix PR 22541: When values are equal, minmax should return the rightmost one ↵Marshall Clow2015-02-111-0/+35
| | | | | | in the initializer_list llvm-svn: 228839
* [libcxx] Properly convert the count arguments to the *_n algorithms before use.Eric Fiselier2015-02-105-11/+30
| | | | | | | | | | | | | | | | | Summary: The requirement on the `Size` type passed to *_n algorithms is that it is convertible to an integral type. This means we can't use a variable of type `Size` directly. Instead we need to convert it to an integral type first. The problem is finding out what integral type to convert it to. `__convert_to_integral` figures out what integral type to convert it to and performs the conversion, It also promotes the resulting integral type so that it is at least as big as an integer. `__convert_to_integral` also has a special case for converting enums. This should only work on non-scoped enumerations because it does not apply an explicit conversion from the enum to its underlying type. Reviewers: chandlerc, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7449 llvm-svn: 228704
* Test commit: remove whitespace at EOL.Dimitry Andric2015-02-051-1/+1
| | | | llvm-svn: 228280
* Fix PR#22433. The algorithm is_partitioned was testing an item in the middle ↵Marshall Clow2015-02-021-5/+24
| | | | | | of the sequence twice. llvm-svn: 227824
* Fix PR#22427. The implementation of inplace_merge had a \'small data set\' ↵Marshall Clow2015-02-022-3/+12
| | | | | | optimization; if either half of the merge was small (i.e, less than 9 items), it did an inplace merge rather than allocating a buffer and doing a faster/smarter merge. However, this failed to satisfy the complexity requirements in the standard. Remove that code. Add tests to check the complexity, and add the same tests for std::merge, since we are in that section of the test suite anyway. llvm-svn: 227811
* Removed some tabs that snuck into the test suite. No functionality changeMarshall Clow2015-01-283-15/+15
| | | | llvm-svn: 227363
OpenPOWER on IntegriCloud