Commit Graph

56 Commits

Author SHA1 Message Date
Stephan T. Lavavej 709be5eef2 [libcxx] [test] Rename _Up to U, etc. NFCI.
This improves readability and (theoretically) improves portability,
as _Ugly names are reserved.

This performs additional de-uglification, so all of these tests
follow the example of iterator.traits/empty.pass.cpp.

llvm-svn: 310761
2017-08-11 20:54:09 +00:00
Stephan T. Lavavej aae63566dc [libcxx] [test] Rename _Tp to T. NFCI.
This improves readability and (theoretically) improves portability,
as _Ugly names are reserved.

llvm-svn: 310758
2017-08-11 20:53:53 +00:00
Stephan T. Lavavej e71235b438 [libcxx] [test] Consistently list "c++98, c++03" in chronological order. NFC.
llvm-svn: 310155
2017-08-05 00:44:19 +00:00
Stephan T. Lavavej 9ea675ef8c [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.

llvm-svn: 309468
2017-07-29 00:55:35 +00:00
Stephan T. Lavavej 4159db7698 [libcxx] [test] Untabify, NFC.
llvm-svn: 309464
2017-07-29 00:55:10 +00:00
Rachel Craik 3e2ef40812 Remove addtional parameters in function std::next() and std::prev()
Creating a function pointer with proper parameters pointing to std::next() or std::prev() should work.
This change moves the invented paramater for enable_if over to the return type to resolve this QoI issue.

Patch by Jason Liu.

Differential Revision: https://reviews.llvm.org/D34649

llvm-svn: 308932
2017-07-24 22:17:05 +00:00
Stephan T. Lavavej 5984426f91 [libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 305848
2017-06-20 21:00:02 +00:00
Marshall Clow c44a727ee4 Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did anything useful.
llvm-svn: 303675
2017-05-23 18:55:32 +00:00
Marshall Clow f51ee63247 Make next/prev/advance/distance operations on iterators be constexpr. I missed this when I implemented the rest of P0031R0
llvm-svn: 303281
2017-05-17 18:51:36 +00:00
Stephan T. Lavavej 40608ce4c9 [libcxx] [test] Be compatible with LWG 2438 "std::iterator inheritance shouldn't be mandated".
In C++17, these iterators are allowed but not required
to inherit from the deprecated std::iterator base class.

Fixes D32727.

llvm-svn: 302318
2017-05-05 23:01:38 +00:00
Eric Fiselier 4f73dbf403 Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES
llvm-svn: 296854
2017-03-03 03:43:25 +00:00
Mehdi Amini 2f75ad4e51 Recommit r296712: "Fix Apple-specific XFAIL directive in libc++ test"
The test is passing with c++11 and c++14 but not c++1z on this
particular version of the compiler. Try to use lit boolean condition
to satisfy this constaint.

llvm-svn: 296725
2017-03-02 02:01:11 +00:00
Mehdi Amini cd0b56c5cf Revert "Fix Apple-specific XFAIL directive in libc++ test"
This reverts commit r296712. It broke our bot.

It turns out that the test is passing with c++11 and c++14 but
not c++1z on this particular version of the compiler. Since one
job is defaulting to c++1z and the other is testing all config I'm
not sure how to fix this...

llvm-svn: 296724
2017-03-02 01:57:40 +00:00
Mehdi Amini 48c4a82105 Fix Apple-specific XFAIL directive in libc++ test
This tests is failing in XCode 7.0. But Xcode 7.3 that shipped
an updated clang has this test passing. This is fixing green dragon
which runs this configuration.

llvm-svn: 296712
2017-03-01 23:45:03 +00:00
Eric Fiselier 3c35491f02 Update all bug URL's to point to https://bugs.llvm.org/...
llvm-svn: 295434
2017-02-17 08:37:03 +00:00
Stephan T. Lavavej a730ed3149 [libcxx] [test] Fix comment typos, strip trailing whitespace.
No functional change, no code review.

llvm-svn: 292434
2017-01-18 20:10:25 +00:00
Stephan T. Lavavej 12195f1f03 [libcxx] [test] Strip trailing whitespace. NFC, no code review.
llvm-svn: 291322
2017-01-07 01:12:15 +00:00
Marshall Clow 020b623a3b Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access' for C++17
llvm-svn: 290976
2017-01-04 17:58:17 +00:00
Eric Fiselier a3f141113e Fix unused warning which only triggers in C++11
llvm-svn: 290475
2016-12-24 01:12:28 +00:00
Eric Fiselier fd83822741 Fix unused parameters and variables
llvm-svn: 290459
2016-12-23 23:37:52 +00:00
Eric Fiselier a0620a1c45 XFAIL test for more apple-clang versions
llvm-svn: 289767
2016-12-15 05:41:07 +00:00
Eric Fiselier a361aa3cc9 XFAIL test on apple-clang-7.0
llvm-svn: 289716
2016-12-14 21:44:08 +00:00
Eric Fiselier fec6be9c81 Recommit r286884: P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator.
No code changes were needed, but I updated a few tests.
Also resolved P0509 and P0521, which required no changes to the library or tests.

This patch was reverted due to llvm.org/PR31016. There is a bug in Clang 3.7
which causes default.pass.cpp to fails. That test is now marked as XFAIL for that
clang version.

This patch was originally authored by Marshall Clow.

llvm-svn: 289708
2016-12-14 21:22:48 +00:00
Stephan T. Lavavej f2e24f568b [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 7/7.
test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
Add static_cast<char> because basic_istream::get() returns int_type (N4606 27.7.2.3 [istream.unformatted]/4).

test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
Add static_cast<char> because toupper() returns int (C11 7.4.2.2/1).

test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
This test is intentionally writing doubles to ostream_iterator<int>.
It's silencing -Wliteral-conversion for Clang, so I'm adding C4244 silencing for MSVC.

test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
Given `extern float zero;`, the expression `1./zero` has type double, which emits a truncation warning
when being passed to test<float>() taking float. The fix is to say `1.f/zero` which has type float.

test/std/numerics/complex.number/cmplx.over/arg.pass.cpp
test/std/numerics/complex.number/cmplx.over/norm.pass.cpp
These tests were constructing std::complex<double>(x, 0), emitting truncation warnings when x is long long.
Saying static_cast<double>(x) avoids this.

test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
This was using `int s` to construct and seed a linear_congruential_engine<T, stuff>, where T is
unsigned short/unsigned int/unsigned long/unsigned long long. That emits a truncation warning in the
unsigned short case. Because the range [0, 20) is tiny and we aren't doing anything else with the index,
we can just iterate with `T s`.

test/std/re/re.traits/value.pass.cpp
regex_traits<wchar_t>::value()'s first parameter is wchar_t (N4606 28.7 [re.traits]/13). This loop is
using int to iterate through ['g', 0xFFFF), emitting a truncation warning from int to wchar_t
(which is 16-bit for some of us). Because the bound is exclusive, we can just iterate with wchar_t.

test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
This test is a little strange. It's trying to verify that basic_string's (InIt, InIt) range constructor
isn't confused by "N copies of C" when N and C have the same integral type. To do this, it was
testing (100, 65), but that eventually emits truncation warnings from int to char. There's a simple way
to avoid this - passing (static_cast<char>(100), static_cast<char>(65)) also exercises the disambiguation.
(And 100 is representable even when char has a signed range.)

test/std/strings/string.view/string.view.hash/string_view.pass.cpp
Add static_cast<char_type> because `'0' + i` has type int.

test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
What's more horrible than nested bind()? pow() overloads! This operator()(T a, T b) was assuming that
std::pow(a, b) can be returned as T. (In this case, T is int.) However, N4606 26.9.1 [cmath.syn]/2
says that pow(int, int) returns double, so this was truncating double to int.
Adding static_cast<T> silences this.

test/std/utilities/function.objects/unord.hash/integral.pass.cpp
This was iterating `for (int i = 0; i <= 5; ++i)` and constructing `T t(i);` but that's truncating
when T is short. (And super truncating when T is bool.) Adding static_cast<T> silences this.

test/std/utilities/utility/exchange/exchange.pass.cpp
First, this was exchanging 67.2 into an int, but that's inherently truncating.
Changing this to static_cast<short>(67) avoids the truncation while preserving the
"what if T and U are different" test coverage.
Second, this was exchanging {} with the explicit type float into an int, and that's also
inherently truncating. Specifying short is just as good.

test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
Add static_cast<short>. Note that this affects template argument deduction for make_pair(),
better fulfilling the test's intent. For example, this was saying
`typedef std::pair<int, short> P1; P1 p1 = std::make_pair(3, 4);` but that was asking
make_pair() to return pair<int, int>, which was then being converted to pair<int, short>.
(pair's converting constructors are tested elsewhere.)
Now, std::make_pair(3, static_cast<short>(4)) actually returns pair<int, short>.
(There's still a conversion from pair<nullptr_t, short> to pair<unique_ptr<int>, short>.)

Fixes D27544.

llvm-svn: 289111
2016-12-08 21:38:57 +00:00
Eric Fiselier 465bd0fc00 Enable warnings by default for C++ >= 11 and fix -Wshadow occurances
llvm-svn: 288557
2016-12-03 00:27:13 +00:00
Stephan T. Lavavej d72ece6462 [libcxx] [test] D27027: Strip trailing whitespace.
llvm-svn: 287829
2016-11-23 22:03:28 +00:00
Vedant Kumar 50d161ce0f Revert "P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests."
This reverts commit r286884, because it breaks the Xcode 7 builders:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1583

Here is a PR that tracks the issue:
https://llvm.org/bugs/show_bug.cgi?id=31016

llvm-svn: 287004
2016-11-15 18:48:36 +00:00
Marshall Clow 48b520a7b6 P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests.
llvm-svn: 286884
2016-11-14 20:41:17 +00:00
Stephan T. Lavavej 0f901c7ec4 [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.
This replaces every occurrence of _LIBCPP_STD_VER in the tests with
TEST_STD_VER. Additionally, for every affected
file, #include "test_macros.h" is being added explicitly if it wasn't
already there.

https://reviews.llvm.org/D26294

llvm-svn: 286007
2016-11-04 20:26:59 +00:00
Marshall Clow 720ef47200 Implement another part of P0031; adding constexpr to move_iterator
llvm-svn: 285818
2016-11-02 15:30:26 +00:00
Marshall Clow c1b73a1793 Adding a missing constexpr test for reverse_iterator operator[].
llvm-svn: 284731
2016-10-20 14:57:34 +00:00
Marshall Clow 1b8f260ed9 Implement constexpr support for reverse_iterator. Reviewed as https://reviews.llvm.org/D25534
llvm-svn: 284602
2016-10-19 15:12:50 +00:00
Marshall Clow 610ad3a598 Add tests for LWG2544. We already implement this; just adding tests to make sure that we keep doing it.
llvm-svn: 283749
2016-10-10 14:10:45 +00:00
Asiri Rathnayake a6199170ac [libcxx] Add missing c++98 xfail. NFC.
This is the only test failing in c++98 mode at the moment.

llvm-svn: 281731
2016-09-16 14:32:19 +00:00
Marshall Clow 2a837eae39 Mark test as XFAIL for C++03, rather than providing a dummy pass.
llvm-svn: 280605
2016-09-04 00:37:06 +00:00
Marshall Clow 7725546a32 std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.
llvm-svn: 278282
2016-08-10 20:04:46 +00:00
Eric Fiselier 8892b4eef0 Fix ::reference typedef in insert iterators.
Since at least the C++11 standard insert iterators are specified
as having ::reference typedef void. Libc++ was not doing that.
This patch corrects the typedef.

This patch changes the std::iterator base class of insert_iterator,
front_insert_iterator and back_insert_iterator. This should not
be an ABI breaking change.

llvm-svn: 274209
2016-06-30 04:40:50 +00:00
Eric Fiselier cb1fd66853 Make instreambuf.iterator/types.pass.cpp more portable.
llvm-svn: 274207
2016-06-30 04:31:09 +00:00
Eric Fiselier 56f23a3f7f Move remaining _LIBCPP_VERSION tests into test/libcxx
llvm-svn: 273367
2016-06-22 02:23:22 +00:00
Eric Fiselier f2f2a6395f 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!

llvm-svn: 272716
2016-06-14 21:31:42 +00:00
Eric Fiselier d04c685168 Remove trailing whitespace in test suite. Approved by Marshall Clow.
llvm-svn: 271435
2016-06-01 21:35:39 +00:00
Asiri Rathnayake 6edc12c886 [libcxx] Improve tests to use the UNSUPPORTED lit directive
Quite a few libcxx tests seem to follow the format:
 #if _LIBCPP_STD_VER > X
   // Do test.
 #else
   // Empty test.
 #endif
We should instead use the UNSUPPORTED lit directive to exclude the test on
earlier C++ standards. This gives us a more accurate number of test passes
for those standards and avoids unnecessary conflicts with other lit
directives on the same tests.

Reviewers: bcraig, ericwf, mclow.lists

Differential revision: http://reviews.llvm.org/D20730

llvm-svn: 271108
2016-05-28 08:57:35 +00:00
Eric Fiselier 6a05b007ff Test hijacking ADL for operator& in the stream iterator constructors.
llvm-svn: 269838
2016-05-17 21:01:20 +00:00
Eric Fiselier 7b65137677 Add test for r269789
llvm-svn: 269812
2016-05-17 19:52:32 +00:00
Eric Fiselier fb42f4c44a Void cast runtime-unused variables. Patch from STL@microsoft.com
llvm-svn: 268284
2016-05-02 19:15:48 +00:00
Marshall Clow a64a8fc969 Rename a few tests that had typos in their names. No functional change. Thanks to STL for the catch
llvm-svn: 267287
2016-04-23 14:31:00 +00:00
Eric Fiselier 906c50859b Fix LWG issue #2106: move_iterators returning prvalues
llvm-svn: 267091
2016-04-22 00:49:12 +00:00
Marshall Clow 05333fc8af Implement LWG#680, which was missed lo these many moons ago, and was reported as bug #27259. As a drive-by fix, replace the hand-rolled equivalent to addressof in __wrap_iter with the real thing.
llvm-svn: 265914
2016-04-11 03:54:53 +00:00
Eric Fiselier 6469c3ec17 Mark some test XFAIL for GCC 4.9 due to missing is_trivial* traits
llvm-svn: 258287
2016-01-20 04:59:57 +00:00
Marshall Clow e5f1288fa0 Implement LWG#2353: std::next is over-constrained
llvm-svn: 252407
2015-11-07 17:48:49 +00:00