Commit Graph

64 Commits

Author SHA1 Message Date
Marshall Clow
82091c2583 Some of the tests from earlier today had 'int' as the return type when it should have been 'bool'. Fix that. It doesn't change the behavior of any of the tests, but it's more accurate.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322505 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 19:32:32 +00:00
Marshall Clow
6a1c2ffea4 More P0202 constexpr-ifying. All the find_XXX algorithms in this commit.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322504 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 19:26:05 +00:00
Marshall Clow
bb8010f6f2 partition_point gets the P0202 treatment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322493 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 17:53:34 +00:00
Marshall Clow
de4b2869d7 More constexpr algorithms from P0202. any_of/all_of/none_of.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322492 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 17:20:36 +00:00
Marshall Clow
8d0d82585a First part of P0202: Adding constexpr modifiers to functions in <algorithm> and <utility>. This commit is all the is_XXX algorithms.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322489 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 16:16:32 +00:00
Marshall Clow
210d12c946 Fix misspelled macro name - thanks to andrew@ispras.ru for the catch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322196 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10 16:25:04 +00:00
Marshall Clow
334063336b Add the C++17 extensions to std::search. Include the default searcher, but not the Boyer-Moore or Boyer-Moore-Horspool searcher (yet). BUT put the BM and BMH tests in place, marked to XFAIL. The other searchers will follow soon
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 19:18:00 +00:00
Stephan T. Lavavej
dd2a900c0b [libcxx] [test] Fix MSVC warnings, null pointer deref.
test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
Silence MSVC warning C4244. This is expected when passing
floating-point values for size.

test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
Avoid MSVC "warning C4293: '<<': shift count negative or too big,
undefined behavior". MSVC sees (1ULL << N) and warns - being guarded
by const bool canFit is insufficient. A small change to the code
avoids the warning without the need for a pragma.

Remove a spurious printf() declaration from to_ullong.pass.cpp.

Change ULL to UL in to_ulong.pass.cpp. The ULL suffix was
probably copy-pasted.

test/std/utilities/tuple/tuple.general/ignore.pass.cpp
Use LIBCPP_STATIC_ASSERT for consistency with other files.

test/support/container_test_types.h
Fix a null pointer dereference, found by MSVC /analyze
warning C6011 "Dereferencing NULL pointer 'm_expected_args'."

Fixes D41030.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@320535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13 00:51:27 +00:00
Marshall Clow
aeded2bf6e Fix PR#35948: generate_n does not accept floating point Size arguments.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319675 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 18:59:14 +00:00
Billy Robert O'Neal III
7e250fcdc1 Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 21:37:26 +00:00
Billy Robert O'Neal III
b981667776 Tolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org/D39080
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318277 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 07:45:07 +00:00
Marshall Clow
3b8f03d964 Mark test as unsupported on C++98/03, since it uses move_iterator
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 16:07:59 +00:00
Marshall Clow
c3fa9655a4 Fix PR#35119 : set_union misbehaves with move_iterators. Thanks to Denis Yaroshevskiy for both the bug report and the fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 15:50:00 +00:00
Marshall Clow
90dfa2804a Fix test for C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@311967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29 01:10:51 +00:00
Marshall Clow
25a78dcd77 Fix PR31166: std::inplace_merge seems to be unstable. Thanks to Jan Wilken Dörrie for the suggested fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@311952 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:16:13 +00:00
Stephan T. Lavavej
5d91f314f1 [libcxx] [test] Change comments to say C++ instead of c++. NFC.
This makes them consistent (many comments already used uppercase).

The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:35 +00:00
Stephan T. Lavavej
a686caad20 [libcxx] [test] Untabify, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:10 +00:00
Stephan T. Lavavej
b836deb5db [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:00:02 +00:00
Marshall Clow
10411c1626 Add non-parallel version of for_each_n (+tests) from the Parallelism TS
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 02:29:54 +00:00
Stephan T. Lavavej
559442652c [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 01:43:58 +00:00
Eric Fiselier
6b17a7ba2c Cleanup _LIBCPP_HAS_NO_<c++11-feature> in algorithm
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300625 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 23:26:47 +00:00
Marshall Clow
50e32f569c Update the algorithm tests to not use the (deprecated) function binders. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298618 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 16:13:50 +00:00
Marshall Clow
699c414d73 Use 'REQUIRES: c++98 || c++03 || c++11 || c++14' instead of the deprecated 'REQUIRES-ANY: c++98, c++03, c++11, c++14'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298600 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 14:20:43 +00:00
Marshall Clow
03b862f6ea Remove random_shuffle in C++17. Please use shuffle instead. If you have to, you cant get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE before including any libc++ headers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298597 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 13:43:37 +00:00
Marshall Clow
426546ecec Stop using random_shuffle in the libc++ test suite. It's going to be removed in c++17. Use shuffle() instead. No change to libc++, just the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294328 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-07 18:41:25 +00:00
Eric Fiselier
a2cd270943 Enable the -Wsign-compare warning to better support MSVC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-11 05:31:00 +00:00
Stephan T. Lavavej
f1cc7ff4c9 [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289110 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 21:38:44 +00:00
Stephan T. Lavavej
43d9250a01 [libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288749 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06 01:13:51 +00:00
Stephan T. Lavavej
3bea61851a [libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288747 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06 01:13:29 +00:00
Stephan T. Lavavej
21208822a8 [libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288746 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06 01:13:14 +00:00
Eric Fiselier
29616b3806 Work around more -Wshadow warnings
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 02:26:28 +00:00
Stephan T. Lavavej
e33c0b01f8 [libcxx] [test] D27027: Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287829 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:03:28 +00:00
Stephan T. Lavavej
bdf8bae8bb [libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287825 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:02:35 +00:00
Stephan T. Lavavej
9a65a47871 [libcxx] [test] D27015: Fix MSVC warning C4018 "signed/unsigned mismatch", part 3/12.
Change unsigned to int in parameters.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287823 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:02:16 +00:00
Stephan T. Lavavej
388c2a8e68 [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287822 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:01:58 +00:00
Stephan T. Lavavej
a9bcd3dae8 [libcxx] [test] D27013: Fix MSVC warning C4018 "signed/unsigned mismatch", part 1/12.
Change loop indices from int to std::size_t.

Also, include <cstddef> when it wasn't already being included.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:01:19 +00:00
Stephan T. Lavavej
0252201f9e [libcxx] [test] D26816: Fix non-Standard assumptions when testing sample().
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.)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 21:54:43 +00:00
Marshall Clow
698cce6e0e Add missing include in test; NFC. Thanks to Jonathan Wakely for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284120 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-13 13:21:38 +00:00
Eric Fiselier
fd1c9dddcc Purge all usages of _LIBCPP_STD_VER under test/std/algorithm
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283643 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:25:23 +00:00
Eric Fiselier
917af0a073 Implement C++17 std::sample.
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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-28 22:14:37 +00:00
Eric Fiselier
17c38db650 Mark LWG 2716 as complete - shuffle and sample disallows lvalue URNGs.
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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279947 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-28 21:55:00 +00:00
Eric Fiselier
aafdbda646 Fix portability issues in <random> tests. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:36:18 +00:00
Marshall Clow
0b02cf8cf1 Implement LWG#2688: 'clamp misses preconditions and has extraneous condition on result'. We already did this, just added tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 17:52:51 +00:00
Eric Fiselier
256f000cdc Add array bounds assertions to satisfy MSVC's /analyze flag. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-26 19:48:29 +00:00
Eric Fiselier
22bff1afcc Move remaining _LIBCPP_VERSION tests into test/libcxx
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273367 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 02:23:22 +00:00
Eric Fiselier
d24c465bea Replace __cplusplus comparisons and dialect __has_feature checks with TEST_STD_VER.
This is a huge cleanup that helps make the libc++ test suite more portable.
Patch from STL@microsoft.com. Thanks STL!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 21:31:42 +00:00
Asiri Rathnayake
1575e3e813 [libcxx] Fix c++98 test failures.
Adds XFAIL/UNSUPPORTED lit tags as appropriate. Gets a clean test run
for -std=c++98 on Fedora 20.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271741 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 21:40:03 +00:00
Eric Fiselier
84acb1ec3f Remove trailing whitespace in test suite. Approved by Marshall Clow.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 21:35:39 +00:00
Eric Fiselier
bda804ea25 Remove names of unreferenced parameters. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267852 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 03:17:56 +00:00
Eric Fiselier
849c551745 Add braces, move braces, and rename variables to avoid shadowing. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267844 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 02:45:11 +00:00