summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/algorithms/alg.sorting
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-232-2/+2
|
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-214-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* Fix a couple of unguarded operator, calls in algorithm. Fixes PR#43063. ↵Marshall Clow2019-08-2012-0/+93
| | | | | | Updated all the heap tests to check this. llvm-svn: 369448
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3131-0/+41
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* Support tests in freestandingJF Bastien2019-02-0481-81/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1981-324/+243
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Add diagnostics for min/max algorithms when a InputIterator is used.Eric Fiselier2018-08-221-0/+37
| | | | | | | | | | These algorithms require a ForwardIterator or better. Ensure we diagnose the contract violation at compile time instead of of silently doing the wrong thing. Further algorithms will be audited in upcoming patches. llvm-svn: 340426
* [libcxx] [test] Strip trailing whitespace, NFC.Stephan T. Lavavej2018-02-126-7/+7
| | | | llvm-svn: 324959
* Work around GCC constexpr initialization bugEric Fiselier2018-02-031-1/+1
| | | | llvm-svn: 324165
* Last batch of P0202 constexpr additions: includes/set_intersection/exchangeMarshall Clow2018-01-224-4/+87
| | | | llvm-svn: 323159
* Still more P0202 constexpr-ifying. This batch is: ↵Marshall Clow2018-01-222-2/+35
| | | | | | for_each/for_each_n/lexicographical_compare llvm-svn: 323147
* Really comment out the constexpr tests.Marshall Clow2018-01-222-30/+30
| | | | llvm-svn: 323072
* implement (but leave commented out) the constexpr tests from P0202 for ↵Marshall Clow2018-01-222-2/+47
| | | | | | std::merge. merge requires std::copy, which isn't constexpr yet. llvm-svn: 323070
* More constexpr algorithms from P0202: lower_bound, upper_bound, equal_range, ↵Marshall Clow2018-01-168-20/+153
| | | | | | binary_search llvm-svn: 322529
* Some of the tests from earlier today had 'int' as the return type when it ↵Marshall Clow2018-01-158-8/+8
| | | | | | should have been 'bool'. Fix that. It doesn't change the behavior of any of the tests, but it's more accurate. llvm-svn: 322505
* First part of P0202: Adding constexpr modifiers to functions in <algorithm> ↵Marshall Clow2018-01-158-4/+116
| | | | | | and <utility>. This commit is all the is_XXX algorithms. llvm-svn: 322489
* Mark test as unsupported on C++98/03, since it uses move_iteratorMarshall Clow2017-10-301-0/+2
| | | | llvm-svn: 316917
* 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] Untabify, NFC.Stephan T. Lavavej2017-07-294-35/+35
| | | | llvm-svn: 309464
* Cleanup _LIBCPP_HAS_NO_<c++11-feature> in algorithmEric Fiselier2017-04-187-34/+27
| | | | llvm-svn: 300625
* 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-1115-26/+27
| | | | llvm-svn: 289363
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-082-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-062-4/+4
| | | | | | | | | | | | 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] 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
* Purge all usages of _LIBCPP_STD_VER under test/std/algorithmEric Fiselier2016-10-0812-26/+47
| | | | llvm-svn: 283643
* 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
* 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-0110-16/+16
| | | | 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-182-4/+4
| | | | 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
* 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
* Move test into test/std subdirectory.Eric Fiselier2014-12-2077-0/+8668
llvm-svn: 224658
OpenPOWER on IntegriCloud